Someone please suggest an equivalent for NSTimer in Javascript, here is my requirement.
You can use Javascript's setInterval()
/setTimeout()
Methods to run the piece of code.
You can invalidate using clearTimeout()
/clearInterval()
You can visit the following page from W3Schools to get more info in detail: https://www.w3schools.com/js/js_timing.asp