Data Types

Understanding Primitive Types

Emily Y Leung
3 min readAug 27


Field notes while going through the JavaScript Roadmap

Photo by Luca Bravo on Unsplash

What are Data Types?

  • Every variable in JavaScript has a data type which is used to describe the operations possible on that value
  • There are 7 primitive data types: Number, BigInt, String, Boolean, Null, Undefined and Symbol
  • The Object data type is not considered a primitive — and will be covered in a separate post


A string is a sequence of textual characters

Each character in a string has a given position, formally known as an index. To access a character in a string, we specify its index as an integer (starting from 0)

let lang = "JavaScript";

let firstLetter = lang[0];

console.log(firstLetter); // Output: "J"


A Number is an integer or whole number without a decimal point

let value = 123;

A float or floating-point number is a Number with a decimal point

let value = -1.23;


A Boolean is logical data type that can only return a true or false value

let isAdmin = true;


Undefined is a data type which describes the absence of a value. This usually happens when a variable is declared but never initialized (i.e. no value was assigned)

let age;

console.log(age); // Output: undefined


A BigInt is a data type used to store integer values that are too big to be represented by a Number

let totalSum = 9999999999;


A Null data type is used to indicate the absence of an object. It is a data type which can only be initialized by a human — never the result of a function.

let num = null;

console.log(num); // Output: null


A Symbol is a unique and immutable value (cannot be changed) which is used to create unique property keys so that they don’t…