Simplifying JavaScript

Extracted from:

Simplifying JavaScript

Writing Modern JavaScript with ES5, ES6, and Beyond

This PDF file contains pages extracted from Simplifying JavaScript, published by

the Pragmatic Bookshelf. For more information or to purchase a paperback or

PDF copy, please visit .

Note: This extract contains some colored text (particularly in code listing). This

is available only in online versions of the books. The printed versions are black

and white. Pagination might vary between the online and printed versions; the

content is otherwise identical.

Copyright ? 2018 The Pragmatic Programmers, LLC.

All rights reserved.

No part of this publication may be reproduced, stored in a retrieval system, or transmitted,

in any form, or by any means, electronic, mechanical, photocopying, recording, or otherwise,

without the prior consent of the publisher.

The Pragmatic Bookshelf

Raleigh, North Carolina

Simplifying JavaScript

Writing Modern JavaScript with ES5, ES6, and Beyond

Joe Morgan

The Pragmatic Bookshelf

Raleigh, North Carolina

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, PragProg 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.

Our Pragmatic books, screencasts, and audio books can help you and your team create

better software and have more fun. Visit us at .

The team that produced this book includes:

Publisher: Andy Hunt

VP of Operations: Janet Furlow

Managing Editor: Brian MacDonald

Supervising Editor: Jacquelyn Carter

Development Editor: Andrea Stewart

Copy Editor: Nancy Rapoport

Indexing: Potomac Indexing, LLC

Layout: Gilson Graphics

For sales, volume licensing, and support, please contact support@.

For international rights, please contact rights@.

Copyright ? 2018 The Pragmatic Programmers, LLC.

All rights reserved.

No part of this publication may be reproduced, stored in a retrieval system, or transmitted,

in any form, or by any means, electronic, mechanical, photocopying, recording, or otherwise,

without the prior consent of the publisher.

Printed in the United States of America.

ISBN-13: 978-1-68050-288-6

Encoded using the finest acid-free high-entropy binary digits.

Book version: P1.0¡ªApril 2018

Introduction

Ever get the feeling you¡¯ve woken up and everything¡¯s different? If you¡¯ve

looked at modern JavaScript, you may feel like you woke up in a new world

where nothing¡¯s the same.

Yesterday, you were tweaking a simple jQuery accordion. Today, you look at

some JavaScript code and the ubiquitous jQuery $ operator is gone. In its

place are lots of strange dots (...) and strange symbols (=>) (the spread operator

and arrow functions, as you¡¯ll soon learn). Sure, some things look familiar,

such as class, but even that seems to be unpredictable (where are the private

methods?).

Are you perplexed? Maybe a little excited? Well, I have good news for you:

Everything has changed for the better.

When the ECMAScript 6 spec was released¡ªES6 for short¡ªJavaScript code

changed dramatically. The changes were so substantial that after reading this

book you¡¯ll be able to tell at a glance which code was written with pre-ES6

syntax and which code was written with post-ES6 syntax. JavaScript now is

different. Modern JavaScript is any code composed with post-ES6 syntax.

Modern JavaScript is a pleasure to write. I¡¯m a long-time unrepentant JavaScript fan, but I¡¯ll admit that I found the old syntax a little clunky at times,

and it was pretty hard to defend. Modern JavaScript is better. But it¡¯s changed

significantly, and catching up can be hard.

How To Use This Book

In this book, you¡¯ll learn to write modern JavaScript from the ground up. But

I¡¯m not going to throw a bunch of syntax at you. I want you to learn to think

in terms of contemporary JavaScript. You¡¯ll see every piece of syntax with a

recommendation for not just how to use it, but when to use it.

Also, I¡¯m not going to run through every minor syntax change. I know your

time is valuable, so I¡¯ll only show you syntax that has high impact and that¡¯s

? Click HERE to purchase this book now. discuss

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download