One of the most fundamental characteristics of a programming language is the set of data types it supports. These are the type of values that can be represented and manipulated in a programming language.
- Numbers, 123, 120.50 etc.
- Stringsof text e.g. “This text string” etc.
- Booleang. true or false.
You can also declare multiple variables with the same var keyword as follows −
var money, name;
Storing a value in a variable is called variable initialization. You can do variable initialization at the time of variable creation or at a later point in time when you need that variable.
For instance, you might create a variable named money and assign the value 2000.50 to it later. For another variable, you can assign a value at the time of initialization as follows.
var name = “Ali”;
money = 2000.50;
Note − Use the var keyword only for declaration or initialization, once for the life of any variable name in a document. You should not re-declare same variable twice.