indexOf method in an object array?

前端 未结 27 2442
别跟我提以往
别跟我提以往 2020-11-22 02:18

What\'s the best method to get the index of an array which contains objects?

Imagine this scenario:

var hello = {
    hello: \'world\',
    foo: \'ba         


        
27条回答
  •  情深已故
    2020-11-22 02:39

    I compared several methods and received a result with the fastest way to solve this problem. It's a for loop. It's 5+ times faster than any other method.

    Here is the test's page: https://jsbench.me/9hjewv6a98

提交回复
热议问题