Skip to content

Instantly share code, notes, and snippets.

@suhailgupta03
Created August 4, 2023 16:21
Show Gist options
  • Save suhailgupta03/f703ada8790178b0f3706d7e0a34c34a to your computer and use it in GitHub Desktop.
Save suhailgupta03/f703ada8790178b0f3706d7e0a34c34a to your computer and use it in GitHub Desktop.
// setInterval(function() {
// console.log("Playing MP4");
// },500); // continuous loop
// // every 500 ms, it will print "Playing MP4"
setTimeout(function() {
console.log("Downloaded MP4");
}, 3000); // 3s
console.log("Starting to download");
@suhailgupta03
Copy link
Author

let i = 1;

let intvl = setInterval(function() {
if(i > 5) {
clearInterval(intvl);
}else {
console.log(i++);
}
},500);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment