var

var – Declares one or more variables, and optionally sets a value to them.

Description

var mixed variable, …

Parameters

Name Description Type Default Optional
variable, … One or more variable values to be set. mixed No

Examples

Example #1 – var example
var x = 'y'; // Sets "y" an the value for the variable named x. console.log(x);
var a = 'b', x = 'y'; console.log(a); console.log(x);

External references