--

there are various errors in the examples code (missing open curly, arrayFinal2["element"] = 1 instead of arrayFinal2[element] = 1, etc) but most importantly, this post demonstrates that a loop that does nothing is faster than a loop that does something, because JIT and engines optimize for you. If you need to use properties instead of indexes don't use arrays, use either a `Map` or an object instead.

--

--

Andrea Giammarchi
Andrea Giammarchi

Written by Andrea Giammarchi

Web, Mobile, IoT, and all JS things since 00's. Formerly JS engineer at @nokia, @facebook, @twitter.

No responses yet