Answers for "measure current time javascript"

4

javascript measure time function

var startTime = performance.now();

alert('Run some function here');

var endTime = performance.now();
var totalTime=endTime-startTime;// time took to run in milliseconds

alert('Total time:'+totalTime +'ms');
Posted by: Guest on July-25-2019
7

javascript calculate time

console.time("timer");   //start time with name = timer
console.timeEnd("timer"); //end timer and log time difference
Posted by: Guest on July-08-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language