Which One Is Primitive Data Type in JavaScript?


Larry Thompson

JavaScript is a versatile programming language used for creating dynamic and interactive web applications. To understand JavaScript better, it’s important to know about its data types. In JavaScript, there are two main categories of data types: primitive data types and non-primitive data types.

Primitive Data Types:

Primitive data types in JavaScript are the building blocks of any program. They are immutable, meaning they cannot be changed once they are created. There are six primitive data types in JavaScript:

1. Number:
The number data type represents both integer and floating-point numbers.

It is used for performing arithmetic operations such as addition, subtraction, multiplication, and division. For example:

var age = 25;
var height = 5.7;

2. String:
The string data type represents a sequence of characters enclosed in single quotes (”) or double quotes (“”).

Strings are used for storing text values and can be manipulated using various string methods. For example:

var name = “John Doe”;
var message = “Hello, World!”;

3. Boolean:
The boolean data type has two possible values: true and false.

It is used for logical operations and conditional statements such as if-else statements and while loops. For example:

var isLoggedin = true;
var isValid = false;

4. Null:
The null data type represents the intentional absence of any object value.

It is often used to initialize variables that may be assigned an object later in the program execution. For example:

var car = null;

5. Undefined:
The undefined data type represents the absence of a defined value.

It is the default value assigned to variables that have been declared but not initialized with a value. For example:

var address;

6. Symbol:
The symbol data type was introduced in ECMAScript 6 and represents a unique identifier.

Symbols are often used as keys for object properties to avoid naming conflicts. For example:

var id = Symbol(“unique-id”);

These primitive data types play a crucial role in JavaScript programming. Understanding their characteristics and proper usage is essential for writing efficient and bug-free code.


In this article, we discussed the primitive data types in JavaScript. We learned about the number, string, boolean, null, undefined, and symbol data types. Each of these data types has its own purpose and characteristics.

To recap:

  • The number data type represents numeric values.
  • The string data type represents textual values.
  • The boolean data type represents true or false values.
  • The null data type represents the intentional absence of any object value.
  • The undefined data type represents the absence of a defined value.
  • The symbol data type represents a unique identifier.

By understanding these primitive data types, you will be able to write more efficient and effective JavaScript code.

Remember to use appropriate HTML styling elements like for bold text, for underlined text,


  • for lists, and


    , etc. for subheaders to make your content visually engaging and organized.

    Happy coding!