time a function in javascript code example
Example 1: time taken for a function javascript
console.time("timer"); //start time with name = timer
console.timeEnd("timer"); //end timer and log time difference
Example 2: javascript setinterval
setInterval(function(){
console.log("print this once every 3 second");
}, 3000);//run this thang every 3 seconds