Expressions

Object literal

Try the free JavaScript compiler

Creates an ordinary object using property definitions. Identifier keys and shorthand are valid; computed names are evaluated. Object literal syntax differs from JSON syntax.

Formal Syntax & Structure

javascript syntaxjavascript
{ key: value, otherKey: otherValue }

Working Example

Example Snippetjavascript
const a={name:"pen",count:3};console.log(a.name,a.count);
JavaScript Reference