【发布时间】:2019-05-14 06:49:51
【问题描述】:
我有上面的数组。我想将{"temperature":{"work":30,"home":24}} 对象输入到数组的第一个。
所以数组应该以:
开头0 : {title : "tptp", {"temperature":{"work":30,"home":24}}, lastview:"12-12 21:2"}
我的代码是
console.log("below is home");
console.log(this.home);
console.log(this.home[0].push({"temperature": {"work":30,"home":24}}));
但我有错误TypeError: this.home[0].push is not a function。
【问题讨论】:
-
home[0]是一个对象 - 是否要合并这些对象? -
我的错。我没有看到您实际上想要合并对象。
-
this.home[0] 可能不是数组
标签: javascript arrays typeerror