bugl
bugl
HomeLearnPatternsSearch
HomeLearnPatternsSearch

Loading lesson path

Learn/JavaScript/JavaScript Foundations
JavaScript•JavaScript Foundations

JavaScript Built-In Objects

Concept visual

JavaScript Built-In Objects

Pointer walk
two pointers
leftright102132436485116
left=0
right=6
1
3

Start at both ends

A

JavaScript variable can be either a

Primitive type or an

Object type.

The

Object data type can hold many different object types.

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

Create a person object with 4 properties: firstName, lastName, age and eyeColor:

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

Learn More:

JavaScript Object Tutorial

Built-In Object Types

A JavaScript object can represent a

JavScript object or a

User defined object.

Formula

Built - in JavavaScript object types can be:

Object

Description

Array

Array of values accessed by a numerical index

Map

Formula

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

Previous

JavaScript Hoisting

Next

JavaScript Common Mistakes