Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
For let vs var vs const
(version: 1)
Comparing performance of:
for in with let vs for in with var vs for in with const
Created:
one year ago
by:
Guest
Jump to the latest result
Script Preparation code:
let array = new Array(100).fill(1); let total = 0;
Tests:
for in with let
for (let i in array) { total += array[i]; }
for in with var
for (var i in array) { total += array[i]; }
for in with const
for (const i in array) { total += array[i]; }
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (3)
Previous results
Fork
Test case name
Result
for in with let
for in with var
for in with const
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
9 months ago
)
User agent:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 YaBrowser/24.7.0.0 Safari/537.36
Browser/OS:
Yandex Browser 24 on Linux
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
for in with let
111986.3 Ops/sec
for in with var
112291.3 Ops/sec
for in with const
115480.6 Ops/sec
Related benchmarks:
var only vs let + const
Storing array length before for
for/for in/forEach array sum
for/for in/forEach array sum 222
var for/for in/forEach array sum
var len for/for in/forEach array sum
for/for len
[i] vs .at(i)
2Sum array: for vs forEach vs for..in vs for..of vs reduce
Comments
Confirm delete:
Do you really want to delete benchmark?