1//single event i.e. alarm, time in milliseconds
2var timeout = setTimeout(function(){yourFunction()},10000);
3//repeated events, gap in milliseconds
4var interval = setInterval(function(){yourFunction()},1000);
1const t0 = performance.now();
2doSomething();
3const t1 = performance.now();
4console.log(`Call to doSomething took ${t1 - t0} milliseconds.`);
5