1
從value
構造爲null
然後overrided由String
在離子3.它是一種形式的值重寫我的Condition
對象的屬性,當我得到這個奇怪的行爲的屬性。當我嘗試訪問它覆蓋後,我得到null
而不是"8"
。這是我跑了console.log
的圖片:JavaScript對象有兩個值
這是我正在試圖重寫value
屬性:
for (var property in form.value) {
if (form.value.hasOwnProperty(property)) {
var index = this.numberArray.findIndex((cond) => cond.name == property)
this.numberArray[index].value = form.value[property];
}
}
我看到你在你的findIndex上使用非嚴格的等於==。也許嘗試將其改爲嚴格平等===,同時您應該提供一些數據以便循環使用 – Rick
當您立即通過數組中的索引訪問項目時,並不需要'findIndex'。你可以在同一個iteree中使用'find()'(除了使用嚴格的等號作爲@Arrow提到的例外) – mhodges
嘿@Arrow!感謝您的意見。我試圖改變嚴格的平等,但並沒有改變結果。通過提供一些數據來處理循環,你的意思是什麼? – MateusLSantos