Complete the greetings() function below that displays a countdown from 5 to 1 on the console, with the delay of one second between each number, and then displays "Happy New Year!". You just have to complete the function and no need to call it.
setTimeout and setInterval
New year
Report a typo
Sample Input 1:
Sample Output 1:
5
4
3
2
1
Happy New Year!Write a program in JavaScript
let days = 5;
function greetings() {
const intervalId = ...
...
if (count === 0) {
clearInterval(...);
console.log(...);
}
});
}
___
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.
Create a free account to access the full topic
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.