Now that we have a basic idea about the variable , we need to understand more about what goes inside those variable which are the different DataTypes.
Everything that we work inside of an application ultimately comes down to Primitive DataTypes.
Primitive data types include undefined, string, number and boolean
Undefined variables haven't been assigned values yet.If we put nothing inside a variable it is type of UnDefined.
var myUndefined;
- A string is a series of characters and is surrounded by quotes
var myStringWelcome = "Hello World";
- A number can be either an integer or a decimal
var myNumberInt = 100;
var myNumberDecimal = 100.100;
- Booleans have two values: true or false
var isMyBooleanTrue = true;
var isMyBooleanFalse = false;
JavaScript is loosely typed, so the type is tied to the value held in the variable, not the variable itself!
Top comments (0)