JavaScript object vs. array lookup performance

前端 未结 3 778
無奈伤痛
無奈伤痛 2021-02-05 09:26

What is the performance difference between retrieving the value by key in a JavaScript object vs iterating over an array of individual JavaScript objects?

In my case, I

3条回答
  •  盖世英雄少女心
    2021-02-05 10:17

    associative arrays are much slower then arrays with numbered indexes, because associative arrays work by doing string comparisons, which are much, much slower then number comparisons!

提交回复
热议问题