Single-Valued Reference Properties
Let’s learn how to implement single-valued reference properties.
We'll cover the following...
Implementation
When coding a class, the ES2015 feature of function parameter destructuring allows us to use a single constructor parameter as a record with a simplified syntax for defining its fields. We make use of this new feature by obtaining a simplified class definition syntax, as shown in the following example:
Press + to interact
class Book {constructor({ isbn, title, year, ...}) {this.isbn = isbn;this.title = title;this.year = year;...}...}
...