JavaScript - T. J. Crowder - E-Book

JavaScript E-Book

T. J. Crowder

0,0
25,99 €

-100%
Sammeln Sie Punkte in unserem Gutscheinprogramm und kaufen Sie E-Books und Hörbücher mit bis zu 100% Rabatt.

Mehr erfahren.
Beschreibung

All of JavaScript's newest features, in depth, made easy to understand. JavaScript is a rapidly changing language and it can be challenging to keep up with all the new toys being added. JavaScript: The New Toys explores the newest features of the world's most popular programming language while also showing readers how to track what's coming next. After setting the stage by covering who manages the process of improving JavaScript, how new features get introduced, terminology, and a high-level overview of new features, it details each new or updated item in depth, with example uses, possible pitfalls, and expert recommendations for updating old habits in light of new features. JavaScript: The New Toys: * Covers all the additions to JavaScript in ES2015-ES2020 plus a preview of what's coming next * Explores the latest syntax: nullish coalescing, optional chaining, let and const, class syntax, private methods, private fields, new.target, numeric separators, BigInt, destructuring, default parameters, arrow functions, async functions, await, generator functions, ... (rest and spread), template literals, binary and octal literals, ** (exponentiation), computed property/method names, for-of, for-await-of, shorthand properties, and others * Details the new features and patterns including modules, promises, iteration, generators, Symbol, Proxy, reflection, typed arrays, Atomics, shared memory, WeakMap, WeakSet, and more * Highlights common pitfalls and explains how to avoid them * Shows how to follow the improvements process and even participate in the process yourself * Explains how to use new features even before they're widely supported With its comprehensive coverage and friendly, accessible style, JavaScript: The New Toys provides an invaluable resource for programmers everywhere, whether they work in web development, Node.js, Electron, Windows Universal Apps, or another JavaScript environment.

Sie lesen das E-Book in den Legimi-Apps auf:

Android
iOS
von Legimi
zertifizierten E-Readern

Seitenzahl: 926

Veröffentlichungsjahr: 2020

Bewertungen
0,0
0
0
0
0
0
Mehr Informationen
Mehr Informationen
Legimi prüft nicht, ob Rezensionen von Nutzern stammen, die den betreffenden Titel tatsächlich gekauft oder gelesen/gehört haben. Wir entfernen aber gefälschte Rezensionen.



Table of Contents

COVER

INTRODUCTION

WHAT DOES THIS BOOK COVER?

WHO SHOULD READ THIS BOOK

HOW TO USE THIS BOOK

HOW TO CONTACT THE AUTHOR

1 The New Toys in ES2015–ES2020, and Beyond

DEFINITIONS, WHO'S WHO, AND TERMINOLOGY

WHAT ARE THE “NEW TOYS”?

HOW DO NEW TOYS GET CREATED?

KEEPING UP WITH THE NEW TOYS

USING TODAY'S TOYS IN YESTERDAY'S ENVIRONMENTS, AND TOMORROW'S TOYS TODAY

REVIEW

NOTES

2 Block-Scoped Declarations: let and const

AN INTRODUCTION TO LET AND CONST

TRUE BLOCK SCOPE

REPEATED DECLARATIONS ARE AN ERROR

HOISTING AND THE TEMPORAL DEAD ZONE

A NEW KIND OF GLOBAL

CONST: CONSTANTS FOR JAVASCRIPT

BLOCK SCOPE IN LOOPS

OLD HABITS TO NEW

NOTE

3 New Function Features

ARROW FUNCTIONS AND LEXICAL THIS, SUPER, ETC.

DEFAULT PARAMETER VALUES

“REST” PARAMETERS

TRAILING COMMAS IN PARAMETER LISTS AND FUNCTION CALLS

THE FUNCTION NAME PROPERTY

FUNCTION DECLARATIONS IN BLOCKS

OLD HABITS TO NEW

4 Classes

WHAT IS A CLASS?

INTRODUCING THE NEW CLASS SYNTAX

COMPARING WITH THE OLDER SYNTAX

CREATING SUBCLASSES

LEAVING OFF OBJECT.PROTOTYPE

NEW.TARGET

CLASS DECLARATIONS VS. CLASS EXPRESSIONS

MORE TO COME

OLD HABITS TO NEW

NOTES

5 New Object Features

COMPUTED PROPERTY NAMES

SHORTHAND PROPERTIES

GETTING AND SETTING AN OBJECT'S PROTOTYPE

METHOD SYNTAX, AND SUPER OUTSIDE CLASSES

SYMBOL

NEW OBJECT FUNCTIONS

SYMBOL.TOPRIMITIVE

PROPERTY ORDER

PROPERTY SPREAD SYNTAX

OLD HABITS TO NEW

NOTES

6 Iterables, Iterators, for-of, Iterable Spread, Generators

ITERATORS, ITERABLES, THE FOR-OF LOOP, AND ITERABLE SPREAD SYNTAX

GENERATOR FUNCTIONS

OLD HABITS TO NEW

NOTES

7 Destructuring

OVERVIEW

BASIC OBJECT DESTRUCTURING

BASIC ARRAY (AND ITERABLE) DESTRUCTURING

DEFAULTS

REST SYNTAX IN DESTRUCTURING PATTERNS

USING DIFFERENT NAMES

COMPUTED PROPERTY NAMES

NESTED DESTRUCTURING

PARAMETER DESTRUCTURING

DESTRUCTURING IN LOOPS

OLD HABITS TO NEW

NOTES

8 Promises

WHY PROMISES?

PROMISE FUNDAMENTALS

USING AN EXISTING PROMISE

ADDING HANDLERS TO ALREADY SETTLED PROMISES

CREATING PROMISES

OTHER PROMISE UTILITY METHODS

PROMISE PATTERNS

PROMISE ANTI-PATTERNS

PROMISE SUBCLASSES

OLD HABITS TO NEW

NOTES

9 Asynchronous Functions, Iterators, and Generators

ASYNC FUNCTIONS

ASYNC ITERATORS, ITERABLES, AND GENERATORS

OLD HABITS TO NEW

NOTES

10 Templates, Tag Functions, and New String Features

TEMPLATE LITERALS

IMPROVED UNICODE SUPPORT

ITERATION

NEW STRING METHODS

UPDATES TO THE MATCH, SPLIT, SEARCH, AND REPLACE METHODS

OLD HABITS TO NEW

NOTES

11 New Array Features, Typed Arrays

NEW ARRAY METHODS

ITERATION, SPREAD, DESTRUCTURING

STABLE ARRAY SORT

TYPED ARRAYS

OLD HABITS TO NEW

NOTES

12 Maps and Sets

MAPS

SETS

WEAKMAPS

WEAKSETS

OLD HABITS TO NEW

NOTES

13 Modules

INTRODUCTION TO MODULES

MODULE FUNDAMENTALS

RENAMING EXPORTS

RE-EXPORTING EXPORTS FROM ANOTHER MODULE

RENAMING IMPORTS

IMPORTING A MODULE'S NAMESPACE OBJECT

EXPORTING ANOTHER MODULE'S NAMESPACE OBJECT

IMPORTING A MODULE JUST FOR SIDE EFFECTS

IMPORT AND EXPORT ENTRIES

IMPORTS ARE LIVE AND READ-ONLY

MODULE INSTANCES ARE REALM-SPECIFIC

HOW MODULES ARE LOADED

IMPORT/EXPORT SYNTAX REVIEW

DYNAMIC IMPORT

TREE SHAKING

BUNDLING

IMPORT METADATA

WORKER MODULES

OLD HABITS TO NEW

14 Reflection—Reflect and Proxy

REFLECT

PROXY

OLD HABITS TO NEW

NOTES

15 Regular Expression Updates

THE FLAGS PROPERTY

NEW FLAGS

NAMED CAPTURE GROUPS

LOOKBEHIND ASSERTIONS

UNICODE FEATURES

OLD HABITS TO NEW

NOTES

16 Shared Memory

INTRODUCTION

HERE THERE BE DRAGONS!

BROWSER SUPPORT

SHARED MEMORY BASICS

MEMORY IS SHARED, NOT OBJECTS

RACE CONDITIONS, OUT-OF-ORDER STORES, STALE VALUES, TEARING, AND MORE

THE ATOMICS OBJECT

SHARED MEMORY EXAMPLE

HERE THERE BE DRAGONS! (AGAIN)

OLD HABITS TO NEW

NOTES

17 Miscellany

BIGINT

NEW INTEGER LITERALS

NEW MATH METHODS

EXPONENTIATION OPERATOR (**)

DATE.PROTOTYPE.TOSTRING CHANGE

FUNCTION.PROTOTYPE.TOSTRING CHANGE

NUMBER ADDITIONS

SYMBOL.ISCONCATSPREADABLE

VARIOUS SYNTAX TWEAKS

VARIOUS STANDARD LIBRARY / GLOBAL ADDITIONS

ANNEX B: BROWSER-ONLY FEATURES

TAIL CALL OPTIMIZATION

OLD HABITS TO NEW

NOTES

18 Upcoming Class Features

PUBLIC AND PRIVATE CLASS FIELDS, METHODS, AND ACCESSORS

OLD HABITS TO NEW

NOTES

19 A Look Ahead …

TOP-LEVEL AWAIT

WEAKREFS AND CLEANUP CALLBACKS

REGEXP MATCH INDICES

STRING.PROTOTYPE.REPLACEALL

ATOMICS ASYNCWAIT

VARIOUS SYNTAX TWEAKS

LEGACY DEPRECATED REGEXP FEATURES

THANK YOU FOR READING!

NOTES

APPENDIX: Fantastic Features and Where to Find ThemFantastic Features and Where to Find Them

FEATURES IN ALPHABETICAL ORDER

NEW FUNDAMENTALS

NEW SYNTAX, KEYWORDS, OPERATORS, LOOPS, AND SIMILAR

NEW LITERAL FORMS

STANDARD LIBRARY ADDITIONS AND CHANGES

MISCELLANEOUS

INDEX

END USER LICENSE AGREEMENT

List of Tables

Chapter 10

TABLE 10-1: Code Points and Code Units Examples

Chapter 11

TABLE 11-1: The Eleven Typed Arrays

Chapter 13

TABLE 13-1: Import Statements and Import Entries

TABLE 13-2

Chapter 14

TABLE 14-1: Other Reflect Functions

TABLE 14-2: Proxy Traps

Chapter 16

TABLE 16-1

Chapter 17

TABLE 17-1: General Math Functions

TABLE 17-2: Low-Level Math Support Functions

List of Illustrations

Chapter 2

FIGURE 2-1

FIGURE 2-2

FIGURE 2-3

FIGURE 2-4

FIGURE 2-5

FIGURE 2-6

FIGURE 2-7

FIGURE 2-8

Chapter 3

FIGURE 3-1

Chapter 4

FIGURE 4-1

FIGURE 4-2

FIGURE 4-3

FIGURE 4-4

Chapter 5

FIGURE 5-1

FIGURE 5-2

Chapter 7

FIGURE 7-1

FIGURE 7-2

FIGURE 7-3

Chapter 8

FIGURE 8-1

FIGURE 8-2

FIGURE 8-3

FIGURE 8-4

FIGURE 8-5

FIGURE 8-6

FIGURE 8-7

FIGURE 8-8

FIGURE 8-9

Chapter 11

FIGURE 11-1

FIGURE 11-2

FIGURE 11-3

Chapter 12

FIGURE 12-1

FIGURE 12-2

FIGURE 12-3

FIGURE 12-4

FIGURE 12-5

FIGURE 12-6

FIGURE 12-7

Chapter 13

FIGURE 13-1

FIGURE 13-2

FIGURE 13-3

FIGURE 13-4

FIGURE 13-5

FIGURE 13-6

FIGURE 13-7

FIGURE 13-8

FIGURE 13-9

FIGURE 13-10

FIGURE 13-11

FIGURE 13-12

Chapter 15

FIGURE 15-1

Chapter 16

FIGURE 16-1

FIGURE 16-2

FIGURE 16-3

FIGURE 16-4

FIGURE 16-5

Chapter 17

FIGURE 17-1

FIGURE 17-2

Chapter 18

FIGURE 18-1

Guide

Cover

Table of Contents

Begin Reading

Pages

v

xxxi

xxxii

xxxiii

xxxiv

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

59

60

61

62

63

65

66

67

68

69

70

71

72

73

74

75

76

77

78

79

80

81

82

83

84

85

86

87

88

89

90

91

92

93

94

95

96

97

98

99

100

101

102

103

104

105

106

107

108

109

110

111

112

113

114

115

116

117

118

119

120

121

122

123

124

125

126

127

128

129

130

131

132

133

134

135

136

137

138

139

140

141

142

143

144

145

146

147

148

149

150

151

152

153

154

155

156

157

158

159

160

161

162

163

164

165

166

167

168

169

170

171

172

173

174

175

176

177

178

179

180

181

182

183

184

185

186

187

188

189

190

191

192

193

194

195

196

197

198

199

200

201

202

203

204

205

206

207

208

209

210

211

212

213

214

215

216

217

218

219

221

222

223

224

225

226

227

228

229

230

231

232

233

234

235

236

237

238

239

241

242

243

244

245

246

247

248

249

250

251

252

253

254

255

256

257

258

259

260

261

263

264

265

266

267

268

269

270

271

272

273

274

275

276

277

278

279

280

281

282

283

284

285

286

287

288

289

290

291

292

293

294

295

296

297

298

299

300

301

302

303

304

305

306

307

308

309

310

311

312

313

314

315

316

317

318

319

320

321

322

323

324

325

326

327

328

329

330

331

332

333

334

335

336

337

338

339

340

341

342

343

344

345

346

347

348

349

350

351

352

353

354

355

356

357

358

359

360

361

362

363

365

366

367

368

369

370

371

372

373

374

375

376

377

378

379

380

381

382

383

384

385

386

387

388

389

390

391

392

393

394

395

397

398

399

400

401

402

403

404

405

406

407

408

409

410

411

412

413

414

415

417

418

419

420

421

422

423

424

425

426

427

428

429

430

431

432

433

434

435

436

437

438

439

440

441

442

443

444

445

446

447

448

449

450

451

452

453

454

455

456

457

458

459

460

461

462

463

464

465

466

467

468

469

470

471

472

473

474

475

476

477

478

479

480

481

482

483

484

485

486

487

488

489

490

491

492

493

494

495

496

497

498

499

500

501

502

503

504

505

506

507

508

509

510

511

512

513

514

515

516

517

518

519

520

521

522

523

524

525

526

527

528

529

530

531

532

533

534

535

536

537

538

539

540

541

542

543

544

545

546

547

548

549

550

551

552

553

554

555

556

557

558

559

560

561

562

563

564

565

566

567

568

vi

vii

ix

xi

xiii

xv

569

JavaScript®

THE NEW TOYS

 

 

 

 

T.J. Crowder

 

 

NOTES

1

   Formerly known as the European Computer Manufacturer's Association (ECMA), but now only the E in Ecma is capitalized in the organization's name.

2

   

http://www.ecma-international.org/memento/TC39.htm

3

   

https://tc39.es/ecma262/

4

   

https://www.electronjs.org/

5

   

https://reactnative.dev/

6

   

https://nodejs.org/

7

   The committee also cares about significant JavaScript code that isn’t directly related to the web, too.

8

   

https://tc39.es/ecma402/

9

   

https://ecma-international.org/memento/join.htm

10

 

https://github.com/tc39/ecma262

11

 

https://github.com/tc39/proposals

12

 

https://es.discourse.group/

13

 

https://tc39.es/process-document/

14

 

https://tc39.es/agreements/contributor/

15

 

https://github.com/tc39/test262

16

 

https://tc39.es/code-of-conduct/

17

 The Discourse instance largely replaces the informal discussion es-discuss mailing list. The list still exists, but many TC39 representatives recommend avoiding its use.

18

 At least not properly; it has an incomplete version of let and const.

19

 

https://github.com/es-shims/es5-shim

20

 

https://github.com/zloirock/core-js

21

 

https://github.com/es-shims/

22

 

https://github.com/google/traceur-compiler

23

 

http://babeljs.io/

24

 

http://typescriptlang.org/

25

 

https://facebook.github.io/jsx/

26

 

https://reactjs.org/

27

 

https://babeljs.io/docs/en/babel-preset-env#docsNav

28

 

https://gulpjs.com/

29

 

https://gruntjs.com/

30

 

https://webpack.js.org/

31

 

http://browserify.org/

32

 

https://rollupjs.org/