< Javascript Tutorial

Javascript data types

← Previous Next →


JavaScript provides different data types to hold different types of values.

There are two types of data types in JavaScript.
1) Primitive data type
2) Non-primitive (reference) data type


JavaScript is a dynamic type language, means you don't need to specify type of the variable because it is dynamically used by JavaScript engine.
You need to use var here to specify the data type. It can hold any type of values such as numbers, strings etc.

For example:

var a=40; //holding number 
var b="Rahul"; //holding string

JavaScript primitive data types

They are as follows:

Data Type Description
String It represents sequence of characters e.g. "hello"
Boolean It  represents boolean value either false or true
Undefined It represents undefined value
Null It represents null i.e. no value at all

JavaScript non-primitive data types

The non-primitive data types are as follows:

Data Type Description
Object It represents instance through which we can access members
Array It represents group of similar values
RegExp It represents regular expression

 

← Previous Next →