JavascriptMedium
Language View:

What are Primitive Data Types in JavaScript?

Answer (English)

There are 7 primitive data types:

  1. String

  2. Number

  3. Boolean

  4. Null

  5. Undefined

  6. Symbol

  7. BigInt

Shipon Hossen RajuShipon Hossen Raju
July 27, 20260 readers0 comments🇧🇩 Bangla

Examples1

1Example 1

Primitive Data Types in JavaScript

There are 7 primitive data types in JavaScript:

  1. String – Represents text.

    let name = "John";
    console.log(name); // "John"
  2. Number – Represents both integers and floating-point numbers.

    let age = 25;
    let price = 99.99;
    
    console.log(age);   // 25
    console.log(price); // 99.99
  3. Boolean – Represents true or false.

    let isLoggedIn = true;
    let hasPermission = false;
    
    console.log(isLoggedIn);   // true
    console.log(hasPermission); // false
  4. Null – Represents an intentional empty value.

    let data = null;
    
    console.log(data); // null
  5. Undefined – A variable that has been declared but not assigned a value.

    let city;
    
    console.log(city); // undefined
  6. Symbol – Represents a unique and immutable value.

    let id = Symbol("id");
    
    console.log(id); // Symbol(id)
  7. BigInt – Represents very large integers beyond the safe Number limit.

    let bigNumber = 1234567890123456789012345678901234567890n;
    
    console.log(bigNumber);

More from

Discussion0

Please sign in to leave a comment.