JavaScript: The New Toys

Author: T.J. Crowder
Publisher: Wrox
Date: July 2020
Pages: 260
ISBN: 978-1119367956
Print: 1119367956
Kindle: B08C9PH74Z
Audience: Experienced JavaScript developers
Rating: 4.5
Reviewer: Mike James
Great title! Can the book be as good?

JavaScript has changed recently and if you know the basics of JavaScript or learned it just a few years ago then there are large chunks of the language you likely haven't met. The idea of "The New Toys" is to cover the new features without going over the old and it is a good idea. If you want to update your JavaScript then this is worth a look.

Banner

It starts off with an overview of where JavaScript is and how it got there - i.e. how the new toys came about. You really don't need to know this and you can skip it if this sort of things bore you. There is a small section at the end that introduces Babel that you might want to look at. Personaly I think the overhead in getting involved with Babel isn't worth it - just keep to what JavaScript you expect to work everywhere. 

Chapter 2 is where the book really get started on the toys, although this particular topic - declarations - isn't much "fun". This is where the main problem of the book reveals itself - how much does the reader know? Declarations in JavaScript are a complex mess and if you have never encountered ideas such as hoisting and function scope things are going to be slightly more difficult for you. The book does a good job explaining things, but you are going to encounter more than just the new toys.

Declarations are essential but they aren't fun. Chapter 3 moves on to look at what is new in functions and this is where the new toys start to be fun. Arrow functions, default parameters, rest parameters and so on, but all of this is just fluff unless you really understand JavaScript's functions and most don't.

Chapter 4 is about class, and arguably this is just a way of covering up the way JavaScript actually works. So much better to understand constructors and prototype chain inheritance than cover it up under something that looks like a standard, class-based, language. Ignoring this, the chapter does a good job of explaining what is happening.

 

The rest of the book follows the same pattern of introducing blocks of related new features:

  • object features including symbols and spread syntax
  • iterables
  • destructuring 
  • Promises
  • aync functions
  • templates
  • typed arrays, maps and sets
  • reflection
  • new regular expression features
  • shared memory
  • a collection of things that don't fit in - bigInt, math, dates and so on.

The final chapter looks at what is already in the pipeline for future versions and, compared to the big changes of the past, they are small tweeks.

Each chapter ends with an Old Habits to New section which compares how things were done and how you should now do them. This is great, but some of the new toys let you do things you couldn't do in the original JavaScript. You might also conclude that there are missing new toys. All of the features needed for Progressive Web Apps are missing, but this isn't unreasonable as they aren't core JavaScript.

If you already have a good grasp of JavaScript, this will bring you up to speed on the new features. Seeing how they all fit together is a more difficult task. JavaScript isn't the language it once was, but it is still built on the foundations of the old and you need a good grounding to see the new whole. The danger is that if you just read this book you really might be just playing with the toys.

My verdict? A very good book for the old JavaScript expert, not so good for the JavaScript weekend programmer.

  • Mike James is the founder and chief contributing editor of I Programmer. An experienced technical author, he now writes books exclusively for the I Programmer Library, published by I/O Press. His most recent title is JavaScript Jems: The Amazing Parts, is an exploration of what makes JavaScript special.  

To keep up with our coverage of books for programmers, follow @bookwatchiprog on Twitter or subscribe to I Programmer's Books RSS feed for each day's new addition to Book Watch and for new reviews.

Banner


Principled Programming

Author: Tim Teitelbaum
Publisher: DateTree Press
Date: March 2023
Pages: 429
ISBN: 978-8987744109
Print: B0BZF8R467
Audience: General
Rating: 5
Reviewer: Mike James
Principled Programming - what else would you want to do?



The Rust Programming Language, 2nd Ed

Author: Steve Klabnik and Carol Nichols
Publisher: No Starch Press
Date: June 2023
Pages: 560
ISBN: 978-1718503106
Print: 1718503105
Kindle: B0B7QTX8LL
Audience: Systems programmers
Rating: 4.8
Reviewer: Mike James

There's a new edition of what has become the standard text on Rust. Has it matured along with [ ... ]


More Reviews

<ASIN:1871962420>

Last Updated ( Wednesday, 14 October 2020 )