New Object Features

T.J. Crowder · 2020

This chapter deals with the new object features in ES2015+, from features that help a user to write less repetitive or more concise code to the features that let the user do things he/she could not do before. It discusses computed property names and shorthand properties. ES2015 had computed property names, which use square brackets in the property definition itself. Method syntax is not just a shorthand syntax for defining functions in object literals because it does both more and less than a property initialized with a traditional function. In theory, the [[HomeObject]] link is there whether the method uses super or not. In practice, JavaScript engines are likely to optimize the link away if one does not use super. Because people kept wanting or even relying on property order, and JavaScript engines had settled on two similar (but different) orders, to make things predictable the order was standardized in ES2015.

Read the paper · More papers on PaperTik