Curriculum
Course: JavaScript Basic
Login

Curriculum

JavaScript Basic

JSHome

0/216
Text lesson

JS Data Types

JavaScript Data Types

JavaScript encompasses eight data types:

  1. String
  2. Number
  3. BigInt
  4. Boolean
  5. Undefined
  6. Null
  7. Symbol
  8. Object

The Object Datatype

The object data type can encompass:

1. An object
2. An array
3. A date

Examples

// Numbers:
let length = 16;
let weight = 7.5;

// Strings:
let color = “Yellow”;
let lastName = “Johnson”;

// Booleans
let x = true;
let y = false;

// Object:
const person = {firstName:“John”, lastName:“Doe”};

// Array object:
const cars = [“Saab”“Volvo”“BMW”];

// Date object:
const date = new Date(“2022-03-25”);
Note: A JavaScript variable has the capability to store data of any type.