JavaScript Datatype

Data Type:- A data type is a classification of data , programming languages support various types of data like integer , character,string and boolean. When we define data type of attributes then compiler or interpreter came to know how the programmer wants to use the data.

JavaScript Data Type:- JavaScript is a dynamic type language we need not to specify type of the variable because it is dynamically used by JavaScript engine. We just need to use var keyword to specify the data type of variable and it can hold any type of values.

var a = 100; // integer value

var b = "hello World"; // string value

In JavaScript data types classify into two types.

1. Primitive Data Type

2. Non-Primitive Data Type

1. Primitive Data Type:- There are five types of primitive data types in JavaScript. They are as follows:

Data Type Description
Number Represent numeric value 1, 50 , 10000 etc
String Represent sequence of characters “hello” , “morning”
Boolean Represent either true or false
Null Represent null value
Undefined Represent undefined value(unknown)

2. Non-Primitive Data Type:- There are three type of non-primitive data type. they are as following:

Data Type Description
Array Represent group of similar value
Object This is instance of class through which we can call member functions and variables
RegExp Represent regular expression

 

Back                                                                                                                                              Next