/* record the current time (the current time
being the time since the current tab was
loaded in milliseconds) */
const start = performance.now();
// run your function here
/* record the current time after your
function has run */
const end = performance.now();
/* to get the time ellapsed, you simply
subtract the start time from the end time */
const ellapsed = end - start;
/* you could convert this into seconds by
dividing by 1000 */
const secondsEllapsed = ellapsed / 1000;
console.time("timer"); //start time with name = timer
console.timeEnd("timer"); //end timer and log time difference