The operand to the left of the operator must be an LValue. That is, it should be able to take an assignment and store the value.
Be careful not to confuse the single equals with the double equals. Placing a double equals in place of an assignment will not assign the value and may be considered to be a syntax error, since it may perform a comparison in entirely the wrong context. The interpreter may be forgiving enough that a run-time error isn't generated though, but the side effects could be subtle and make it hard to diagnose the cause.
ECMA 262 edition 2 - section - 11.13
ECMA 262 edition 2 - section - 12.2
ECMA 262 edition 3 - section - 11.13
ECMA 262 edition 3 - section - 12.2
Prev | Home | Next |
<= (Less than or equal to) | Up | == (Equal to) |
JavaScript Programmer's Reference, Cliff Wootton Wrox Press (www.wrox.com) Join the Wrox JavaScript forum at p2p.wrox.com Please report problems to support@wrox.com © 2001 Wrox Press. All Rights Reserved. Terms and conditions. |