- Numbers: values such as 1, 2, 3, 4
- Strings: values such as “a”, “boy” this are mostly words or text enclosed in single or double quotation marks
- Boolean: values such as True or False
var x – this declares x as a variable that can store data
var y – this declares y as a variable that can store data
var z – this declares z as a variable that can store data
To store a data into any of the variables, we simply assign the variable to the data as shown below
var x = 3 – over here we declared x as a variable and stored 3 in it
var y = 4 – over here we declared y as a variable and stored 4 in it
var z = 8 – over here we declared z as a variable and stored 8 in it
Another way we can declare multiple variables is shown below
Global variables – this variables are global and can be defined anywhere in your code
Local variables – this variables are not global and can not be placed anywhere in your code. They can only be visible within a function where they are defined.
- variables can not start with a number. They must start with an alphabet or underscore.
- variable names are case sensitive so care should be taken during capitalization.