我有这个JSON:
var myVar = {
"9":"Automotive & Industrial",
"1":"Books",
"7":"Clothing"
};
我想在开头添加一个新元素,最终想要得到这个结果:
var myVar = {
"5":"Electronics",
"9":"Automotive & Industrial",
"1":"Books",
"7":"Clothing"
};
我尝试了这个,但它没有起作用:myVar.unshift({"5":"Electronics"});
谢谢!
myVar
不是一个数组。 - Musa