Menu
Coddy logo textTech

Loop over All

Lesson 17 of 18 in Coddy's Moving Clouds - HTML/CSS/JS Project course.

challenge icon

Challenge

Easy

Currently, your code is probably working only on one cloud, loop over all the clouds:

const elements = document.getElementsByClassName('cloud');

And give each of them a random location, speed, and size.

Note: You will need to click on the refresh button after writing the code:

Make sure you are not creating an endless loop!

Try it yourself

<!DOCTYPE html>
<html>
<head>
    <link rel="stylesheet" href="styles.css">
</head>
    <body>
        <!-- Write HTML code here -->
        <script src="script.js"></script>
    </body>
</html>

All lessons in Moving Clouds - HTML/CSS/JS Project