Javascript Object具有两个值的属性

时间:2017-06-20 22:02:29

标签: javascript object properties

当我通过Ionic 3中的Form中的值覆盖我的Condition对象的属性时,我会遇到这种奇怪的行为。value被构造为null,然后被覆盖一个String。当我在覆盖后尝试访问它时,我得到null而不是"8"。这是console.log我跑过的图片:

console.log

这就是我试图覆盖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];
  }
}

1 个答案:

答案 0 :(得分:0)

你应该使用strict'===',看起来像是来自console.log()

的后期评估