Appendix A. Additional ES6 features
This appendix covers
- Template literals
- Destructuring
- Object literal enhancements
This appendix covers some of the “smaller” ES6 features that don’t fit neatly into the previous chapters. Template literals enable string interpolation and multiline strings, destructuring enables us to easily extract data from objects and arrays, and enhanced object literals improve dealings with, well, object literals.
Template literals
Template literals are a new ES6 feature that make manipulating strings much more pleasant than before. Just think back; how many times have you been forced to write something as ugly as this?
const ninja = { name: "Yoshi", action: "subterfuge" }; const concatMessage = "Name: " + ninja.name ...
Get Secrets of the JavaScript Ninja, Second Edition 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.