var error = new Object ({'1a':'1','1b':'1','2a':'1'}); // like this I have defined around 200 values
if (some condition is true)
error[id] = 0; // id is selected dynamically ( '1a' or '1b' or what ever)
完成所有这些后,我想检查对象错误中的任何一个是否仍然具有值“1”。我使用了以下但它似乎不起作用..
for ( i in error)
if(error[i].value == '1') -some code- // this line gives error, not able to read value
应该是正确的方法...... ??
答案 0 :(得分:1)
只需删除.value
:
if(error[i] == '1'){...}