各位好,由于鄙人js基礎較差,在工程中遇到基礎問題較多,尤其是“萬物皆對象”這個理念。就比如:1、scope.dataArr=;我要為其增加屬性,scope.dataArr.currTopic=xxxx就是錯誤的;然而$scope.dataArr[currTopic]是正確的。2、scope.dataArr中有一個key名為currTopic,初始value為[]。我要為currTopic的value增加值,即想push元素到[]中去。使用scope.dataArr.currTopic.push( xxx ) 又是錯誤的。$scope.dataArr[currTopic].push( xxx ) 是正確的。這是為什么?
js 萬物皆對象的問題
qq_笑_17
2018-11-21 18:13:37