Book Review – Java Script Recipies

Russ Ferguson and Keith Cirkel have managed to write an interesting book about JavaScript with some interesting knowledge. As I have read plenty of JS books and I have almost never worked professionally with JS, I am always eager to review books, which look like problem-solution methodology. Thus, I was really happy when my partners from Apress have decided to send me the hard copy of the book for a review:

The Book in Apress

The free source code in GitHub

As every Apress book, this one also has its programming code in GitHub, available for everyone to download it. Sometimes I consider this practice as if the publisher is saying – “We are so good and convinced in the value that our books bring, that we can prove it to you by sharing the complete code of the book for anyone.“. And I appreciate this approach. After all, if you like the code, you would probably benefit from the book as well.

The book “works” the following way – every chapter is divided into sub-problems. Then, explicitly the following sub-subchapters are defined for each subchapter:

  • Problem
  • Solution
  • The Code
  • How It Works

In 21 chapters, seeing about 300 recipes (or even more, I was lazy to count), you may feel like a StackOverflow veteran in the [java-script] tag. The first recipe I have tried was concerning the variable scope. This was the definition of the problem:

“When using a variable, you want its life to be shorter than the functional scope. For example, you’d lile the variables life to exist within an if statement”

The solution explains that JS has a functional scope, but something else called “block scope” as well. Thus the provided code illustrates it quite well:

The result is quite expectable, but if you are not a js developer, you may never learn about the block scope within your first year. In the code above, in the how it works part, you have an explanation about the difference between the keywords var and let, when the scope is concerned. Thus, the let is tied to the block scope and var is tied to the function scope. Furthermore, let is bound to the attached block, even though it is not in side the block itself (when used with if or for or while).

So, let’s start with the evaluation – the bad parts:

  • Somehow some of the topics are overlapping a bit, thus going into too much details. E.g.:
    • Determining if a value is Less Than Another with the < Operatior
    • Determining if a value is Greater Than Another with the > Operatior
    • Determining if a Value is Less than or Equal to Another with the <= Operator
    • Determining if a Value is Greater than or Equal to Another with the >= Operator
  • There were a few typos, but not in the code, which was ok

The good parts:

  • This really feels like going through a forum and reading only the good topics of a given subject. E.g., if you have not worked with JS for quite some time, reading this book can help you refresh your memories. The examples are quite ok;
  • Although it is written as a go-to reference book, it is quite helpful, explaining some of the basics in JavaScript – e.g. how to make a function, what is IIFE in JS, how to work with RegEx and etc.
  • Although the initial chapters were quite “easily-digestable”, at the end there are some interesting parts

In general, if you are an advanced beginner, who has some ideas about JS, you would be able to profit from the book quite a lot! Enjoy it!

About

VBA Developer

Tagged with: , ,