var json_obj = { "40": [{ "title": "all", "name": "all promotions", "id": "all" },{}], "20": { "title": "best_room_rate", "name": "best room rate", "id": "best_room_rate" }, "10": { "title": "summer rate", "name": "summer rate", "id": "30" } } for (var item in json_obj) { alert(item);//10->20->40 }
请问这里输出结果为什么不是40->20->10呢
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
对象和数组不一样,数组是顺序存储结构,而对象不是。不同的javascript引擎对对象的属性读取顺序都不一样。