Export (0) Print
Expand All

Assignment Operator (=) (JavaScript)

Assigns a value to a variable.

result = expression

result

Any variable.

expression

Any numeric expression.

As the = operator behaves like other operators, expressions using it have a value in addition to assigning that value into variable. This means that you can chain assignment operators as follows:

j = k = l = 0;

j, k, and l equal zero after the example statement is executed.

Supported in the following document modes: Quirks, Internet Explorer 6 standards, Internet Explorer 7 standards, Internet Explorer 8 standards, Internet Explorer 9 standards. See Version Information.

Show:
© 2014 Microsoft