Create Object Literals in JavaScript

JavaScript·1 min read·Jan 1, 2026

In JavaScript, empty objects are created using curly braces {}:

variable = {};

Note: Any object created using this method is referred to as an object literal.

Declaring object properties

Object properties are unique keys-value pairs separated by a comma character:

{  key: value,  ...}

Where:

  • key is a unique string identifier associated with a specific value.
  • value is the value associated with a specific key, which can either be a primitive value, an object, or a function referred to as a method.