How it works...

Like the previous recipe, the syntax uses the names of the variables between the curly braces to determine the property name on the object. Each of the properties is created with the variable name and value of the corresponding constant.

Get ECMAScript Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.