Menu
Coddy logo textTech

Start immediately

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

The setTimeout() method sets a timer, which executes a function or specified piece of code once the timer expires.

For example:

setTimeout(() => {
	console.log("Hello");
}, 1000);

The above example will print "Hello" to the console after 1000 milliseconds (one second).

Read more

challenge icon

Challenge

Easy

Currently, the cloud starts to move only after 3 seconds, use setTimeout() to move the cloud right after 100 milliseconds.

Also, change the alternate to start with moving to the left instead of the right.

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