JavaScript calculate time take for a script to execute

Problem: How to calculate the time taken for a script to execute

Solution:

var startTime =new Date().getTime();


//Your JavaScipt code goes here


var endTime = new Date().getTime();

DEBUG && logInfo(“Time taken (in sec):”+(endTime – startTime)/1000);

Enable Notifications OK No thanks