Enhanced Object Literals

Traditional way of creating an object

Creating an object by assigning fields with values from existing variables is a common operation. In the past, this process involved a lot of noisy code.

Example

Let’s use the old way to create an object with a few fields and methods.

Get hands-on with 1200+ tech skills courses.