Name

= — NN 2 IE J1 ECMA 1

Synopsis

The assignment operator. This operator assigns the evaluated value of the right-hand operand to the variable on the left. After the operation, the variable contains data of the same data type as the original value. Assignment operations can also be chained, with the evaluation of the entire statement starting from the right and working left. Therefore, after the expression:

a = b = c = 25

all three variables equal 25.

Example

var myName = "Theodore Roosevelt"
var now = new Date()

Get Dynamic HTML: The Definitive Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.