0

JAVASCRIPT

    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)

when all this is done I want to check if any one in Object error still have value '1' or not. I have used the following but it does not seem to work..

    for ( i in error)
          if(error[i].value == '1')   -some code-  // this line gives error, not able to read value

what should be the correct method...??

1
  • if you set error[id] = 0 why after you try to read error[i].value? Commented Jun 19, 2014 at 9:20

1 Answer 1

1

Simply remove .value:

if(error[i] == '1'){...}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.