How fast is your code?

Shuvo - Oct 18 '21 - - Dev Community

You ever wanted to know how long does a block of your code takes to execute? Well you have come to the right place.
You can simply wrap your block of code with console.time function to measure how long your code took to execute.

console.time("Label A")
let num = -999999
for(let i = 0; i < 99999; i++){
    num++
}
console.log(num)
console.timeEnd("Label A")
Enter fullscreen mode Exit fullscreen mode

Console.time demo

Make sure to check out my other articles also

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .