Cache variable in the function scope
Is there a performance benefit to replacing == with ===?
Test
with <link>
This version declares i once before
Comparing speed of getting element by id with jQuery vs Vanilla JS
save length of the array in the variable vs get it the loop
Create Your benchmarks
FAQ: FAQ
Source code: GitHub/MeasureThat.net
Report issues: MeasureThat.net/Issues
Based on: Benchmark.js
Facebook page: https://www.facebook.com/MeasureThat.Net
Python benchmarks support: Pyodide