Learning JavaScript tutorial – JavaScript Variables
JavaScript Variables are the main building blocks of JavaScript Scripting language. JavaScript Variables are used for storing (contains) the data (value) and manipulate that data in your programs. Every JavaScript variable has a name, called its ‘identifier’ and optional data called ‘Literals’. JavaScript Variables are declared using JavaScript ‘var’ keyword. JavaScript var keyword allocates storage space for variable to store data. Multiple variables can be declared with one JavaScript ‘var’ keyword. The main advantage of JavaScript variable is, it can hold a value of any data type. Using an undeclared variable causes an error. The best practice of defining JavaScript Variables is with assigned initial values.