🔥Limited Offer: Get 50% OFFon AI & Full Stack Courses🔥
Back to JavaScript Notes
Topic #95

JS Object Types

A JavaScript variable can be either a Primitive type or an Object type.

The Object data type can hold many different object types.

Datatypes

Examples

// Object

const person = {firstName:"John", lastName:"Doe"};

// Array Object

const cars = ["Saab", "Volvo", "BMW"];

// Date Object

const date = new Date("2022-03-25");

JavaScript Objects

JavaScript Objects represent complex data structures and functionalities beyond the primitive data types (string, number, boolean, null, undefined, symbol, bigint).

JavaScript objects are written with curly braces { }.

JavaScript objects contains a collection of different properties.

Object properties are written as name:value pairs, separated by commas.

Example

const person = {firstName:"John", lastName:"Doe", age:50, eyeColor:"blue"};

Note: Learn More: JavaScript Object Tutorial


Built-In Object Types

A JavaScript object can represent a JavaScript object or a User defined object.

Built-in JavaScript object types can be:

Col 1 Col 2
Object Description
Array Array of values accessed by a numerical index
Map Array of key-value pairs where the keys can be of any data type
Set Array of values where each value can only appear once
WeakMap A type of Map with weak references to the stored objects.
WeakSet A type of Set with weak references to the stored objects.
Math An object that provides math constants and functions like PI and random()
Date Object for working with dates and times
RegExp Object for working with regular expressions
Error Object represents error conditions during program execution
JSON Object with methods for parsing values between JSON and objects
Promise Object representing the completion or failure of an asynchronous operation
Int8Array Array for storing fixed-size 8-bits integer values
Int16Array Array for storing fixed-size 16-bits integer values
Int32Array Array for storing fixed-size 32-bits integer values
Float16Array Array for storing fixed-size 16-bits floating-point values
Float32Array Array for storing fixed-size 32-bits floating-point values
Float64Array Array for storing fixed-size 64-bits floating-point values
BigInt64Array Array for storing fixed-size 64-bits big integer values

The typeof Operator

You can use the JavaScript typeof operator to find the type of a JavaScript variable.

The typeof operator returns the type of a variable or an expression:

Example

typeof ""             // Returns
 "string"

typeof "John"         // Returns
 "string"

typeof "John Doe"     // Returns
 "string"

Example

typeof 0              // Returns
 "number"

  typeof 314            // Returns
 "number"

  typeof 3.14           // Returns
 "number"

  typeof (3)            // Returns
 "number"
typeof (3 + 4)        // Returns
 "number"

Note: Learn More: JavaScript typeof Tutorial


JavaScript Arrays

JavaScript arrays are a special type of JavaScript objects.

JavaScript arrays are written with square [ ] brackets.

Array items are separated by commas.

The following code declares (creates) an array called cars, containing three items (car names):

Example

const cars = ["Saab", "Volvo", "BMW"];

Array indexes are zero-based, which means the first item is [0], second is [1], and so on.

Want to go beyond the notes?

Join CodingNow 2.0's JavaScript course — live mentorship, real projects, and 100% placement support.

Enroll Now — Free Demo Available

JS Object Types – FAQs

Quick answers about learning JS Object Types in JavaScript.

This free note from CodingNow 2.0 explains JS Object Types in JavaScript — concept, syntax and worked code examples you can copy, run and revise before interviews.
Yes. Every JavaScript topic on CodingNow 2.0, including JS Object Types, is 100% free with no signup required.
With focused practice, most students grasp JS Object Types in 1–3 days from these notes; pairing it with CodingNow 2.0's mentor-led course takes you to job-ready depth faster.
Use the code examples in this note, then ask doubts for free on the CodingNow 2.0 Community (/community) — expert instructors answer within 24 hours.
WhatsApp
Call NowEnroll Now