Exercise: Implement own findIndex function
My solution:
function ownFindIndex(arr,fn){
for(let i=0;i
What the heck is an event loop? - by Philip Roberts
countDown Exercise: - The goal is to Implement a function called countDown that accepts a time in seconds. The function will print the time remain to the console every second. Instead of printing 0, the function should print "Ring Ring Ring!!!".
My solution:
function countDown(time){
let timerId = setInterval(function(){
console.log("Time remaining:",time);
time--;
if(time === 0){
console.log("Ring Ring Ring!!!");
clearInterval(timerId);
}
},1000);
}