Javascript Tutorial | How to end setInterval

Published: 27 July 2021
on channel: B-dev
118
1

Please Like and Subscribe for more quality content.

In this video, I am going to show you how to stop setInterval by using clearInterval.

***

The code is as follows:

var myVar = setInterval(timer, 1000);

function timer() {
var d = new Date();
var t = d.toLocaleTimeString();
console.log(t);

if (t === "21:11:20") {
clearInterval(myVar);
}
}


On this page of the site you can watch the video online Javascript Tutorial | How to end setInterval with a duration of hours minute second in good quality, which was uploaded by the user B-dev 27 July 2021, share the link with friends and acquaintances, this video has already been watched 118 times on youtube and it was liked by 1 viewers. Enjoy your viewing!