DEV Community

Manthan Ankolekar
Manthan Ankolekar

Posted on

Data types in JavaScript

Primitive Data Types :

Primitive data types in JavaScript include:

  1. Numbers - Integers, floats
  2. Strings - Any data under single quote, double quote or backtick quote
  3. Booleans - true or false value
  4. Null - empty value or no value
  5. Undefined - a declared variable without a value
  6. Symbol - A unique value that can be generated by Symbol constructor

Examples :

let number = 10;

let name = "Manthan";

let value = true/false;

let value = null;

let name;

let a = Symbol();

Enter fullscreen mode Exit fullscreen mode

Non Primitive Data Types

Non-primitive data types in JavaScript includes:

  1. Objects
  2. Arrays

Examples :

let name = {firstName:"Manthan", lastName:"Ank"};

let array = ["value1", "value2"]

let pattern = /w3schools/i;
Enter fullscreen mode Exit fullscreen mode

Top comments (0)