JS: Variable

By Xah Lee. Date: . Last updated: .

in JavaScript before ECMAScript 2015, variable do not need to be declared.

You can simply assign it e.g. x = 3. It becomes property of the Global Object .

After ECMAScript 2015 , variable needs to be declared, by using let or const.

In Strict Mode, variable also need to be declared.

JavaScript. variable