Expressions

Object property shorthand

Try the free JavaScript compiler

Defines a property whose name is an identifier and whose value is read from the corresponding binding. It is shorthand for a property definition with the same key and value expression.

Formal Syntax & Structure

javascript syntaxjavascript
{ name }

Working Example

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