bhylu.com

Advertisements

Object Intro

An object literal creates a record with named properties. Read its fields using dot notation or a bracket expression.

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 learner = {name: "Mira", level: "beginner"};
console.log(learner.name);

What happens

The name field contains Mira.