Make a kitchen timer. Modify the countdown()
function in countdown.js to take a number of seconds, then print each second counting down to zero.
countdown(10);
// should print
// 10...
// 9...
// 8...
// ...
- Use global variable to keep track of time
- Keep track of time without defining any global variables
- Don't define any new variables
- Refactor
countdown
so that you can pass in a callback function that fires every second.
Here is an example of the fourth level:
countdown(10, function (i) {
console.log('THIS IS MY CUSTOM CALLBACK!!!', i);
});