You are currently viewing How to Create Object literal notation JavaScript | Explained

How to Create Object literal notation JavaScript | Explained

Object literal notation JavaScript

In this article, we will discuss Object literal notation in JavaScript.

Creating objects using object literal: {}

While creating objects using object literal, we use pair of flower brackets instead o “new object()”

Syntax :

var objectname = { };

Example :

var react1 = { };

Execution

When the system finds{} on the RHS equal to the symbol, it follows 3 steps

  1. Create new empty objects
  2. sets the value of implicit prototype “__proto__+ of a new empty object to object.prototype
  3. Returns the reference of a new object.

Leave a Reply