bhylu.com

Advertisements

JS Object Types

Arrays, functions, dates, and plain records are objects. A copied reference still points to the same object.

Where to run this

This example uses the JavaScript console playground. Select Run to execute it; the example does not run on this lesson page.

A practical example

JavaScript

const first = {places: 5};
const second = first;
second.places = 3;
console.log(first.places);

What happens

The first reference also reads 3.