ES6 for Humans
Around 46% of the world’s population have Internet access today and the numbers are steadily increasing. While you’re reading this, there are people out there who are using Internet services to book a cab, or a flight, or a table for two at a fancy restaurant; the point is that the Internet today haES6 for HumansDeepak groverHanu prateek KunduruDelhi, IndiaSeattle, Washington, USAISBN13(pbk):978-1-48422622-3ISBN-13(electronic): 978-1-4842-2623-0DOI10.1007/978-1-48422623-0Library of Congress Control Number: 2017944929Copyright o 2017 by Deepak Grover and Hanu KunduruThis work is subject to copyright All rights are reserved by the Publisher, whether the wholeor part of the material is concerned, specifically the rights of translation, reprinting, reuse ofillustrations, recitation, broadcasting, reproduction on microfilms or in any other physicalway, and transmission or information storage and retrieval, electronic adaptation computersoftware, or by similar or dissimilar methodology now known or hereafter developedTrademarked names, logos, and images may appear in this book. Rather than use a trademarksymbol with every occurrence of a trademarked name, logo, or image we use the names, logos,and images only in an editorial fashion and to the benefit of the trademark owner, with nointention of infringement of the trademark.The use in this publication of trade names trademarks, service marks and similar terms, even ifthey are not identified as such, is not to be taken as an expression of opinion as to whether or notthey are subject to proprietary rightsWhile the advice and information in this book are believed to be true and accurate at thedate of publication, neither the authors nor the editors nor the publisher can accept any legalresponsibility for any errors or omissions that may be made. The publisher makes no warranty,express or implied, with respect to the material contained hereinCoverimagebyFreepik(www.freepik.comManaging Director: Welmoed SpahrEditorial director: Todd greenAcquisitions Editor: Louise CorriganDevelopment Editor: James MarkhamTechnical reviewer: phil nashCoordinating Editor: Nancy ChenCopy editor: Karen JamesonArtist: SPi GlobalDistributed to the book trade worldwide by Springer Science+Business Media New York,233 Spring Street, 6th Floor, New York, NY 10013. Phone 1-800-SPRINGER, fax(201)348-4505,e-mailorders-ny@springer-sbm.comorvisitwww.springeronline.comapressMedia, LLC is a California LLC and the sole member (owner) is Springer Science businessMedia Finance Inc (SSBM Finance Inc). SSBM Finance Inc is a Delaware corporationForinformationontranslations,pleasee-mailrights@apress.com,orvisithttp://www.apress.com/rights-permissionsApress titles may be purchased in bulk for academic, corporate, or promotional use eBookversions and licenses are also available for most titles. for more information reference ourPrintandebooKbulkSaleswebpageathttp://www.apress.com/bulk-salesAny source code or other supplementary material referenced by the author inthis book is available to readers on GitHub via the book's product page, located atWww.apress.com/9781484226223.Formoredetailedinformationpleasevisithttp://www.apress.com/source-codePrinted on acid-free paperDedicated to our parents.Without them, we wouldnt be where we are today.Contents at a glanceAbout the authorsAbout the technical reviewerAcknowledgments■■■■■■■■Chapter 1: Getting started with es6aaaatChapter 2: New Syntax in ES6■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■口■■■■■■■■■■■Chapter 3: Destructuring.■■■■■■■■■■■■■■■■■■■a37Chapter 4: classes in ES6Chapter 5: Modules mmmmmmmmmmmmm 65Chapter 6: Symbols in ES6 mm maar■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■75Chapter 7: Arrays and collections a■■■81Chapter 8: Iterators and Generators■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■97■ Chapter9: Promises in es6,,,…,m109Chapter 10: Meta Programming nmn.■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■117Chapter 11: Beyond es6 aan■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■a■■■129Index um 135ContentsAbout the authorsAbout the technical reviewerAcknowledgments■■■■■■■■Chapter 1: Getting started with ES6ES6 The SpecificationHistory of ECMA, ECMAScript, and JavaScript0 ne JavaScript…■■■tUsing Es62345Setting Up ES6 Using Babel and webpackTranspiling with Babel...Setting Up an ES6 Boilerplate558Adding Your Generated bundle s script to your index. htmlSummary a 10Chapter 2: New Syntax in ES6 BERBRRRRRERRBERREVariable Declarations: let, const, and Block ScopingBlock Scoping with let and const12More on Temporal dead Zones. ....................................................14Variables Declarations in loops15Variable Declarations with Function Parameters and Global scope……………16CONTENTSArrow Functions17Using arrow Functions to Create lIFES18A Tale about this wwwwwww 19Using Arrow Functions........................Default function parameters25est and Spread Operators27The spread operator29Object Literal EXtensions30Template Literals and Delimiters.Tagged Template Literals.Summary…,35Chapter 3: Destructuring m mmmmaamamanna 37Destructuring of objects and arrays37object Destructuring SyntaxAssignment Using DestructuringDefault values344Nested Destructuring…242Destructuring Using the rest Syntax44Destructured parameters45Summary......,……47Chapter 4: Classes in ES6 mmmmammmmmmmmmmmammmma 49Classes in es6Defining classes in ES651C| ass declarations……Class Expressions52Class Methods and Accessor Properties.................53Computed Method NamesVIllCONTENTSClass properties and Privacy56Using Constructor Environments157Using WeakMaps57Static Methods and properties58Class inheritance and the Super Keyword ..maanen.emanon.e, 59Inheriting Static Properties.ammmnonmmnonmnon, 61Method0 verriding…,,62Inheritable built-Ins.Summary…,64Chapter5: Modules…65Module Systems and a little history65The Module Pattern in Traditional Javascript.amman...mm.n, 66Modules in es666portingDefault ExportsImporting…,68Importing default valuesExporting an Imported Binding….....…,………70lenaming IdentifiersLoading Modules.aeaaeaaeaaaaaaaaaaa 71Modules in web browsers71Loading Modules with
下载地址
用户评论