课程: Level Up: JavaScript

今天就学习课程吧!

今天就开通帐号,24,700 门业界名师课程任您挑!

Ticking time

Ticking time

(electronic beeps) - Callback functions are functions that get passed to other functions as arguments and get called at a later point in time. Set timeout is one JavaScript function which requires a callback function. We pass, set, timeout a function, and after a certain amount of time, our function gets executed. (electronic beeps) In this challenge, you'll create a ticking clock in the document body. The index.HTML file contains a div with an ID of clock. Using callback functions and DOM manipulation, output a ticking digital clock which displays the current hours, minutes, and seconds. Pause the video here, develop your solution, and when you're ready, come back and I'll walk you through how I solve the challenge. (video game music) Here we can see that we have a div with an ID of clock. First, let's create our clock function. We can grab the clock DOM node using document.querySelector. To get the clock to update…

内容