Rediscovering JavaScript
Master ES6, ES7, and ES8
by Venkat Subramaniam
Version: P1.0 (June 2018)
Copyright 2018 The Pragmatic Programmers, LLC. This book is licensed to the individual who purchased it. We don't copy-protect it because that would limit your ability to use it for your own purposes. Please don't break this trustyou can use this across all of your devices but please do not share this copy with other members of your team, with friends, or via file sharing services. Thanks.
Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in this book, and The Pragmatic Programmers, LLC was aware of a trademark claim, the designations have been printed in initial capital letters or in all capitals. The Pragmatic Starter Kit, The Pragmatic Programmer, Pragmatic Programming, Pragmatic Bookshelf and the linking g device are trademarks of The Pragmatic Programmers, LLC.
Every precaution was taken in the preparation of this book. However, the publisher assumes no responsibility for errors or omissions, or for damages that may result from the use of information (including program listings) contained herein.
About the Pragmatic Bookshelf
The Pragmatic Bookshelf is an agile publishing company. Were here because we want to improve the lives of developers. We do this by creating timely, practical titles, written by programmers for programmers.
Our Pragmatic courses, workshops, and other products can help you and your team create better software and have more fun. For more information, as well as the latest Pragmatic titles, please visit us at http://pragprog.com.
Our ebooks do not contain any Digital Restrictions Management, and have always been DRM-free. We pioneered the beta book concept, where you can purchase and read a book while its still being written, and provide feedback to the author to help make a better book for everyone. Free resources for all purchasers include source code downloads (if applicable), errata and discussion forums, all available on the book's home page at pragprog.com. Were here to make your life easier.
New Book Announcements
Want to keep up on our latest titles and announcements, and occasional special offers? Just create an account on pragprog.com (an email address and a password is all it takes) and select the checkbox to receive newsletters. You can also follow us on twitter as @pragprog.
About Ebook Formats
If you buy directly from pragprog.com, you get ebooks in all available formats for one price. You can synch your ebooks amongst all your devices (including iPhone/iPad, Android, laptops, etc.) via Dropbox. You get free updates for the life of the edition. And, of course, you can always come back and re-download your books when needed. Ebooks bought from the Amazon Kindle store are subject to Amazon's polices. Limitations in Amazon's file format may cause ebooks to display differently on different devices. For more information, please see our FAQ at pragprog.com/frequently-asked-questions/ebooks. To learn more about this book and access the free resources, go to https://pragprog.com/book/ves6, the book's homepage.
Thanks for your continued support,
Andy Hunt
The Pragmatic Programmers
The team that produced this book includes: Andy Hunt (Publisher) Janet Furlow (VP of Operations) Brian MacDonald (Managing Editor) Jacquelyn Carter (Supervising Editor) Liz Welch (Copy Editor) Potomac Indexing, LLC (Indexing) Gilson Graphics (Layout)
For customer support, please contact .
For international rights, please contact .
Table of Contents
Copyright 2018, The Pragmatic Bookshelf.
Early praise for Rediscovering JavaScript
JavaScript used to only have a few good parts. Now most of the parts are good. Although legacy features still remain, new features provided in the ES6/7/8 standards can help you write safer, simpler, and more concise codebut only if you know about them. In this book, Venkat shows everyone, from beginners to experts, how to use the modern language that JavaScript has become.
Ben Rady |
Author of Serverless Single Page Apps and Continuous Testing with Ruby, Rails, and JavaScript |
This concise and brilliant introduction to modern JavaScript keeps the reader engaged by employing simple and direct language, coupled with focused examples and exercises that facilitate rapid learning. Recommended for anyone who wants to discover the joys of ES6/7/8.
Suresh Iyer |
Polyglot Programmer and Senior Staff Applications Engineer, ServiceNow |
Once again, Venkat manages to distill into a concise work the most important changes in the evolution of JavaScript. If you want to update your knowledge of the most ubiquitous language in record time, this book is for you.
Brian Sam-Bodden |
Integrallis Software |
If you tried and abandoned JavaScript long ago, its time to give it a fresh look. This book teaches you all the improvements that bring the language into the 21st century.
Kenneth A. Kousen |
Java Champion and author of multiple books, including Modern Java Recipes |
Acknowledgments
This book project was possible largely because of the support, help, time, and generosity of many. My sincere thanks to everyone who gave his or her knowledge, time, and effort to help me improve this book, and along the way helped me to learn and improve as well.
Special thanks toScott Davis,Suresh Iyer,Ben Rady,Brian Sam-Bodden,Nathaniel Schutta,Stefan Turalski,andJim R. Wilsonfor their reviews. These kind developers and experts reviewed the book for technical correctness, identified gaps in my writing, and suggested ways to improve. Any errors that remain in the book are my own.
The alpha geeks who bought the beta of this book placed their trust in me and I am very thankful for that. Thanks to the readers who provided feedback through the books website, and to early readersRichard L. Brownrigg,George S. Cowan,Brett DiFrischia,Carsten Hess,Richard Hoggart,and Felipe Sultanifor taking the time to make this book better.
I had the luxury of teasing out many of the topics presented in this book at conference presentations, in front of live audiences. The No Fluff Just Stuff (NFJS) conference series, in particular, generously gave me the platform to present different topics related to this book for a couple of years before I started writing. Many thanks to Jay Zimmerman, the director of NFJS, for his continued support.
Writing a book has ups and downs, and the editor can make or break the project. In spite of various challenges along the way, Jackie Carter tirelessly worked on this book to get it in its current shape. I thank her for the positive feedback when she found the writing was good and her guidance in places where improvements were needed.
Thanks to Andy Hunt and the entire Pragmatic Bookshelf team, many who work behind the scenes, for taking on this book project and their continued effort to get it to fruition.
Knowing very well that asking, Did the code you were trying last night work? will start a long rant and a demo, a tireless soul kept asking that question and continued to motivate me. Without her help, none of this would have been possible or even matterthank you, Kavitha. Also thanks to my sons Karthik and Krupa for their understanding when Dad had to hide to work on the book.