- What is Data type
What is Data type
var name=”Jon Dow”;//type of num variable is number
var num=10;//type of bol variable is boolean
- Primitive data type
- Non Primitive data type
Primitive data type
Primitive data types are data type which can hold or store only one value at time. There are 4 primitive data types and those are
var num1=10; //this is number
var num2=10.5; // this is also number
var name=”John”; //exammple of string
var lastname=’Dow’; //this is also string
boolean data type can have either of two values and those values are true and false.
When we don’t initialize or assign value to variable then default value assigned to variable is undefined and type of variable is undefined.
Non primitive data type
Non primitive data type are data type which can hold or store more than one value at time. Non primitive data types are listed below
null is value which we can assign to variable. null means nothing. when we assign null value to variable then type of variable is object.