setInterval & setTimeOut
setInterval & setTimeOut
setTimeout --> Alllows us to run the function once after the interval of time
clearTimeout --> Alllows us to run the function repeatedly after the interval of timeusing set time out
function greet(name, byeText){
console.log("Hello Good Morning " + name + " " + byeText);
}
// timeOut = setTimeout(greet, 5000, "Harry", "Take Care");
// console.log(timeOut);it's used to clear the set timeout // clearTimeout(timeOut);using set intervel
// intervalId = setInterval(greet, 1000, "Harry", "Good Night");
similarly we have clear interval // clearInterval(intervalId);
Comments
Post a Comment