Skip to content

JavaScript the Good Parts

Dušan Dimitrić edited this page Sep 10, 2016 · 9 revisions

JavaScript - The Good Parts

JavaScript: the Good Parts

Ok so Doug Crockford is pretty smart. And you've got to love his diagrams. And the fact that he pushed JSON usage to most modern mainstream applications. Not sure about Shakespeare quotes thought :).

This is not a beginner book so if you're just learning JavaScript look somewhere else first and return to this book after at least a couple of months of experience with the language.

Chapter 2 - Grammar

  • pg. 11/12 - JavaScript's falsy/truthy values
  • pg. 13 - Making sure that the property is on the object itself, not on its prototype with obj.hasOwnProperty(prop)
  • pg. 17 - Short-circuit evaluation with the || operator

Chapter 3 - Objects

  • pg. 21 - Short-circuit evaluating properties on an object
  • pg. 24 - Looping over object properties (Enumeration)
  • pg. 24 - The delete operator (removes a property from an object)

Chapter 4 - Functions

  • pg. 30 - .apply() function methods

Chapter 5 - Inheritance

  • pg. 50 - It's more convenient to put multiple function parameters into an object.
  • pg. 52 - Functional inheritance pattern. A useful solution for making objects that have private members.

Chapter 6 - Arrays

Chapter 7 - Regular Expressions

Great chapter on JS regular expressions. Good to review when needed.

Chapter 8 - Methods

A great Array, Function, Number, Object, RegExp and String method reference.

  • pg. 78 - Array Methods
  • pg. 84 - Function Methods
  • pg. 84 - Number Methods
  • pg. 86 - Object Methods
  • pg. 86 - RegExp Methods
  • pg. 88 - String Methods

Chapter 9 - Style

An ok starting point for JS style I guess. The thing that bothers me though is that Crockford uses underscore style in the book sometimes when he should use camel case (e.g. not_in_array instead of notInArray).

Chapter 10 - Beautiful Features

Appendix A. - Awful Parts

  • pg. 104 - Parsing strings starting with 0 to integeres with parseInt('09', 10)
  • pg. 104 - Floating Point arithmetic. Important when working with money.

Appendix B. - Bad Parts

Appendix C. - JSLint

Appendix D. - Syntax Diagrams

Appendix E. - JSON

  • pg. 140 - JSON parser implementation.

Quotes:

Generally, the craft of programming is the factoring of a set of requirements into a set of functions and data structures.