Explain different data types used in JavaScript. (12)
Explain different data types used in JavaScript.
Data types basically specify what kind of data can be stored and manipulated within a program. JavaScript provides different data types to hold different types of values. There are two types of data types in JavaScript.
a) Primitive data types
b) Non-primitive (reference) data types
Primitive Data Types
Primitive data types can hold only one value at a time. There are five types of primitive data types in JavaScript. They are as follows.
Data Types |
Description |
String |
It represents sequence of characters. Eg. “Hello” |
Number |
It represents numeric values. Eg. 12 |
Boolean |
It represents Boolean value either false or true |
Undefined |
It represents undefined value |
Null |
It represents null, ie, no value at all |
Non Primitive Data types
Non-primitive data types can hold collections of values and more complex entities. The non-primitive data types are as follows.
Data Types |
Description |
Object |
It represents instance through which we can access members |
Array |
It represents group of similar values |
RegExp |
It represents regular expression |
Comments
Post a Comment