bhylu.com

Advertisements

JS Const

A const binding cannot be reassigned. Objects stored in that binding can still have their contents changed.

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 names = ["Mira"];
names.push("Jon");
console.log(names.join(", "));

What happens

The array now contains Mira and Jon.