Lesson 12. New object literal syntax

After reading lesson 12, you will

  • Know how to use shorthand property names
  • Know how to use shorthand method names
  • Know how to use computed property names

I don’t think there’s anything as ubiquitous in JavaScript as the object literal. They’re everywhere. With a tool that’s used so frequently, any conveniences can have a huge net positive on productivity. Three syntactic additions to object literals introduced in ES2015 make them much more of a pleasure to read and write. You don’t gain new functionality, but having code that’s easy to read and write, especially when it comes to maintenance, is just as important a feature.

Consider this

Look at the following object literal. What parts seem ...

Get Get Programming with JavaScript Next now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.