Can I assume the order of response from Object.keys same?

后端 未结 2 1285
南方客
南方客 2021-01-25 12:23
{\"/book\":1,\"/order\":2,\"deliver\":3}

In the UI of my app, When I click on /book, I know from the map, what step to go to. At times I just want to

2条回答
  •  盖世英雄少女心
    2021-01-25 12:45

    It is up to the implementation. From the ES5 spec on Object.keys:

    If an implementation defines a specific order of enumeration for the for-in statement, that same enumeration order must be used in step 5 of this algorithm.

    The "step 5" mentioned there does not specify an order:

     5. For each own enumerable property of O whose name String is P...

提交回复
热议问题