Who This Book Is For
Finally, the book is for people who want a more enjoyable way to learn the language. Its great design and layout should appeal to the book's target audience: People interested in web design and development, folks who tend to be visual learners.
What You'll Get
The book teaches three main things:
- The language itself (its vocabulary and structure)
Each chapter contains an introduction page that tells you what you'll learn, main explanatory pages that discuss the topics you're learning in that chapter, example pages demonstrating how the code can be applied, and summary pages that remind you of what you learned. Diagrams and infographics, as well as reference pages, are also scattered throughout the book.
Here's an example:
One Trick You'll Take Away
It's hard to single out one single tip from this book, since it's explaining programming concepts and methods and how to use them. As an instruction book, all of the information is useful.
However, there's a specific type of tip throughout the book that I appreciated in particular: Best or recommended coding approaches. No matter what the programming language, there are usually several ways to accomplish the same task. Sometimes differences are just a matter of style (e.g., where to place closing parenthesis in particular functions), but at other times recommended "best practices" can help avoid performance issues or other problems with your script.
For example, the book notes that you shouldn't define variables within a loop if those variables don't need to be changed, because the variable will be defined each time the loop runs, taking up precious resources and slowing down your script. As another example, when comparing two values, instead of using the equals operator "==" (e.g., x == y) , it's safer to use the strict equals operator, "===" (e.g., x === y), because the latter will compare both the value and the data type of the two objects, making sure they're truly equal — and avoid errors and other surprises.
Tips like these are great basics that you might not learn if you're self-taught and just jumping in to fiddle with code, and they highlight an overall theme running throughout the book — which should be in every programming book — how to code for efficiency and avoid errors as much as possible.
Besides the visual hooks, the code examples in the book are well thought out and practical, with helpful flowcharts, line numbers, and comments to explain what the code does.
Also, each chapter builds upon previous code examples to explain more complex methods and ideas. For example, a hotel metaphor in the first chapter explains the concept of objects and properties, and later chapters demonstrate how to write functions that check and update hotel room availability.