DEV Community

Cover image for Day 76/100 The Book
Rio Cantre
Rio Cantre

Posted on • Originally published at dev.to

Day 76/100 The Book

Learning is a continuous process with resources widely used with people who acknowledge the challenging journey of accomplishing a successful goal. Though it can be daunting at first, once you grasp the flow and understand the definitions of each detail, one would be grateful for their fruit of labor.

The Book V3

The Chapters

This book renders an excellent understanding of the history of JavaScript. It consists of twenty-one chapters with unique motivational quotes as an introduction to each section. Each part discusses the basics of the language, accessibility, and primary functions. It is curated to fully understand the whole concept and interactive approach of grasping information. Additionally, examples and exercises are uniquely designed to get the feel of the language.

A code example shown in a specific part:

let rabbit = {};
rabbit.speak = function(line) {
  console.log(`The rabbit says '${line}'`);
};

rabbit.speak("I'm alive.");
// → The rabbit says 'I'm alive.'

Enter fullscreen mode Exit fullscreen mode

The following are the three parts with twenty-one chapters inside the book:

Part 1: Language

  1. Values, Types, and Operators
  2. Program Structure
  3. Functions
  4. Data Structures: Objects and Arrays
  5. Higher-Order Functions
  6. The Secret Life of Objects
  7. Project: A Robot
  8. Bugs and Errors
  9. Regular Expressions
  10. Modules
  11. Asynchronous Programming
  12. Project: A Programming Language

Part 2: The Browser

  1. JavaScript and the Browser
  2. The Document Object Model
  3. Handling Events
  4. Project: A Platform Game
  5. Drawing on Canvas
  6. HTTP and Forms
  7. Project: A Pixel Art Editor

Part 3: Node

  1. Node.js
  2. Project: Skill-Sharing Website

The Exercises

Some of the sections contain exercises that practice what you have learned. Most of them are three parts with different methods of showing how the particular element could be used. Each has instructions to follow and hints to give an idea of how to implement the code.

An example exercise:

Disk persistence
The skill-sharing server keeps its data purely in memory. This means that when it crashes or is restarted for any reason, all talks and comments are lost.

Extend the server so that it stores the talk data to disk and automatically reloads the data when it is restarted. Do not worry about efficiency—do the simplest thing that works.

Hints
The simplest solution I can come up with is to encode the whole talks object as JSON and dump it to a file with writeFile. There is already a method (updated) that is called every time the server’s data changes. It can be extended to write the new data to disk.

Pick a filename, for example ./talks.json. When the server starts, it can try to read that file with readFile, and if that succeeds, the server can use the file’s contents as its starting data.

Beware, though. The talks object started as a prototype-less object so that the in operator could reliably be used. JSON.parse will return regular objects with Object.prototype as their prototype. If you use JSON as your file format, you’ll have to copy the properties of the object returned by JSON.parse into a new, prototype-less object.

Code Sandbox

Every exercise has an example solution where you can compare your code. It could be challenging to understand the instructions, but the hints would help you better solve the problem.
Code Sandbox Link

Summary

Having read the book enlightened me of how tough it is to learn JavaScript. I would not say I remembered every detail and solved every exercise. It takes significant effort and time to master the language fully. Reading it alone would not make me one but instead, educate me on how great and brilliant the people are behind this book. It is the third edition, and I am pleased to stumble upon this book and have the time to feel all the sensation of being an expert on a specific skill.

Discussion (0)