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);

Leave a Reply

Your email address will not be published. Required fields are marked *

Enable Notifications OK No thanks