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.
Look at the following object literal. What parts seem ...
Get Get Programming with JavaScript Next 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.