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:
- 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:
let a = 4;
let b = 2;
if(a === 4)
let a = 1;
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 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!