There are two basic data type in javascript:
Note:
Primitives
Example:
var name;
Non Primitive:
object: Object data type variables are reference type.
Example:
var name=null; //null is a keyword and its type is object.
var myArr=[1,2,"5"]; // data type of the array is object
var obj={ firstName : 'shshi' , lastName: 'sharma'};
Note:
Hope it helpful to know about javascript data type.
Thanks for reading.
Note:
- Javascript variable are dynamic type. It means when we assign value to javascript variable then data type of that variable will depend on the type of value the variable holds.
 - typeOf operator is used to find the data type of the variable.
 
Primitives
- string
 - boolean
 - number
 - undefined
 
Non Primitives
- object
 - function
 
string: When we declare a variable by assigning the value to the variable in single quotes i.e. ' ' or in double quotes "". then that variable become of string type.
Example: 
var name="abc";
or
var name='abc';
boolean: When we declare a variable by assigning the value to the variable true/false then that variable becomes of boolean type.
Example:
var flag = true;
or
var flag = false;
number: When we declare a variable by assigning the integer or floating value to the variable then that variable becomes of number type.
Example:
var salary=5000;
var salary=5000.543;
var salary=5.324e+2;
var salary= 5.324e-4;
undefined: When we declare a variable and does not assign any value to it then then that variable becomes of undefined type.
Example:
var name;
Non Primitive:
object: Object data type variables are reference type.
Example:
var name=null; //null is a keyword and its type is object.
var myArr=[1,2,"5"]; // data type of the array is object
var obj={ firstName : 'shshi' , lastName: 'sharma'};
Note:
- In javascript we declare object with key-value pair.
 - Key name can be any value. We can use key name as valid string value.
 - Value can be any valid javascript supported data type.
 
function: When we declare a function and assign function into a variable then data type of the variable becomes function.
Example:
var myFunc=function (){
      alert("hello");
}
Thanks for reading.