jQuery each always sort it?

前端 未结 4 497
被撕碎了的回忆
被撕碎了的回忆 2020-12-20 13:03

I have this object in JS:

var list = {134 : \"A\",140 : \"B\",131 : \"C\"}

I run it with:

jQuery.each(list, function(key, v         


        
4条回答
  •  感情败类
    2020-12-20 13:36

    Object's properties do not have a defined order, as per the specification.

    The mechanics and order of enumerating the properties (...) is not specified.

    Source.

    Therefore, ECMA implementations do not have to iterate in any order. In fact, the order varies in different browsers/versions.

提交回复
热议问题