Sams Teach Yourself JavaScript in 24 Hours (7e)

Author: Phil Ballard
Publisher: Sams Teach Yourself
Date: November 2018
Pages: 432
ISBN: 978-0672338090
Print: 0672338092
Kindle: B07H2KXFWP
Audience: Would-be JavaScript web devs
Rating: 4
Reviewer: Ian Elliot
JavaScript is an easy to learn language so can 24 hours turn you from a beginner to an expert?

The simple answer is that it depends what you mean by "expert". JavaScript has a range of uses from tiny amounts of embedded code in otherwise simple pages to thousands of lines that create a full web app. JavaScript isn't even confined to the client-side browser page any more. Node.js and operating systems like Chrome place it in the server and the desktop respectively. So what it means to be an expert is difficult to say.

Banner

If you simply want to learn enough JavaScript to add a few features to a web page then 24 hours, and this book in particular will probably be enough - but there is so much more to JavaScript than this. This is essentially JavaScript as a scripting language rather than a top of the range object-oriented language with some interesting features. This is the seventh edition of a popular title and while it has been extensively brought up to date it still takes the same approach to the language.

Starting from the basics, Part I  gives you an introduction to JavaScript - its history and its relationship with the browser and the DOM in particular. It is good that the DOM is introduced early because if you are going to script web pages then you can't avoid it. Unfortunately it also still introduces document.write and while it now has a boxout to say "don't use it" - why introduce it so early? The next chapter does a rush job on introducing variables, operators and event handling - topics which don't quite hang together, but which are essential for getting things done. Next we have functions, scope, DOM objects built-in objects and primitive data types - all introduced with enough information for you to make use of them and with a few comments that point you in the right direction for the future. My big objection to Part 1 is that it doesn't proceed logically - it introduces what it has to so that you can start writing scripts. You might like this approach, but I don't think it is a way to master a langauge.

 

Part II is about more advanced, but still core, JavaScript. We have lessons on number, strings, arrays and events. It is only in lession 10 do we reach the flow of control statements - if, for, while, etc - that you need to write real programs. If you are a complete beginner this probably won't be enough for you to master the topic, but with practice you should get there. The level isn't particularly deep and yet it covers things like hexadecimal, octal, floating point integer - all things that could be left until they become relevant. Even though it tries hard to be a graded introduction to the language, we have the more advanced and rarely used topics mixed in with the basics without much guidance as to what to skip over.

Part III is on object-oriented programming, which is a step up in terms of concepts. However, the presentation isn't deep enough - it just presents the very basic ideas and does so quite quickly. It covers the way prototype inheritance works and it goes on to explain the relatively new Class-based syntactic sugar. It is all a bit advanced and yet there is nothing about functions being objects or about binding and this. The remainder moves on to consider practical things - JSON, DOM elements and the idea of feature detection.

Part IV of the book is about manipulating web pages including how to work with local files and the DOM.  We have the basic idea of navigating and modifying the DOM. There are also two lessons on using JavaScript to work with CSS, which is often not included in introductions. It also includes how to animate objects using CSS. All good practical stuff.

Part V is moves on to advanced JavaScript techniques, but it is more a collection of random topics. We have a lessons on using cookies, regular expressions, closure and modules. You can see that the topics range from core JavaScript to using it in a web page. I'm of the opinion that you can't really understand closure unless you realize that in JavaScript a function is an object that has a lifetime independent of when the function just happens to be called.

javascript24hours5ed

The final part of the book, Part VI: Learning the Trade, consists of three hours spent on very general approaches to code. How to write good code, debugging and frameworks/libraries.

This isn't a bad introduction to JavaScript and it does try to give you a modern and slightly more sophisticated look at the subject, but in the main these attempts are too small and insubstantial to make a deep impact on a beginner. While the text has been much improved and brought up-to-date, there is no mention of any of the modern features such as await/async or the Fetch approach to Ajax. You might say that it is reasonable for an introductory book to avoid such advanced ideas, but then why spend so much time on closure? Equally why spend a whole lesson on cookies and not have very much on Ajax?  Perhaps the biggest omission is that there is no emphasis on the idea that JavaScript is an asynchronous language and how you have to keep your code short so as not to block the UI thread.

There is also very little advice on what tools to use to create JavaScript at the start of the book and even the appendix on tools really only touches on Notepad++ and the like. There is no mention of using a full IDE such as Netbeans, Web Matrix or Visual Studio Code to build integrated HTML/JavaScript.

If you want to learn a little JavaScript and a lot of the ways that it is used within web pages, then this is possibly the book for you. It is more like a tour of what you can use JavaScript for with the language being introduced along the way. It is JavaScript as a scripting language with the modern updates thrown in. If you just want to use JavaScript in a cookbook sort of way then it won't tax you with deep explanations of how things work and why they work like they do.  If you want to really master JavaScript as a langauge in its own right then you need to look for something deeper.


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


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 [ ... ]



SQL Server Advanced Troubleshooting and Performance Tuning (O'Reilly)

Author: Dmitri Korotkevitch
Publisher: O'Reilly
Pages: 497
ISBN: 978-1098101923
Print:1098101928
Kindle: B0B197NYD7
Audience: DBAs & database devs
Rating: 5
Reviewer: Ian Stirk

This book aims to improve the performance of your SQL Servers, how does it fare?


More Reviews

 

<ASIN:1871962579>

<ASIN:1871962560>

<ASIN:1871962501>

<ASIN:1871962528>

Last Updated ( Saturday, 27 July 2019 )