is there a better way than performance.now() to tell how long the execution took?

is there like a 1 line solution i think i saw someone who did it once but i can't remember but is there a way to know how long something took to execute but in a faster way than these 4 lines or 3 if we dont console log start? let start = performance.now(); console.log(start);

console.log("hello"); let timeTaken = performance.now() - start;
7 Replies
MarkBoots
MarkBoots2y ago
there is console.time("label") console.timeEnd("label")
Aozen
AozenOP2y ago
oh
Aozen
AozenOP2y ago
Aozen
AozenOP2y ago
did not give me anytime
MarkBoots
MarkBoots2y ago
it could be that the console of jsfiddle does not output correcty (beta). but when you open the console in the browser, it should show
MarkBoots
MarkBoots2y ago
Aozen
AozenOP2y ago
oh ty ❤️
Want results from more Discord servers?
Add your server