JavaScript: The Good Parts

JavaScript: The Good Parts
By Douglas Crockford

List Price: $29.99
Price: $16.61 Details

Availability: Usually ships in 24 hours
Ships from and sold by

106 new or used available from $6.35

Average customer review:
(568 customer reviews)

Product Description

Most programming languages contain good and bad parts, but JavaScript has more than its share of the bad, having been developed and released in a hurry before it could be refined. This authoritative book scrapes away these bad features to reveal a subset of JavaScript that's more reliable, readable, and maintainable than the language as a whole—a subset you can use to create truly extensible and efficient code.

Considered the JavaScript expert by many people in the development community, author Douglas Crockford identifies the abundance of good ideas that make JavaScript an outstanding object-oriented programming language-ideas such as functions, loose typing, dynamic objects, and an expressive object literal notation. Unfortunately, these good ideas are mixed in with bad and downright awful ideas, like a programming model based on global variables.

When Java applets failed, JavaScript became the language of the Web by default, making its popularity almost completely independent of its qualities as a programming language. In JavaScript: The Good Parts, Crockford finally digs through the steaming pile of good intentions and blunders to give you a detailed look at all the genuinely elegant parts of JavaScript, including:

  • Syntax
  • Objects
  • Functions
  • Inheritance
  • Arrays
  • Regular expressions
  • Methods
  • Style
  • Beautiful features

The real beauty? As you move ahead with the subset of JavaScript that this book presents, you'll also sidestep the need to unlearn all the bad parts. Of course, if you want to find out more about the bad parts and how to use them badly, simply consult any other JavaScript book.

With JavaScript: The Good Parts, you'll discover a beautiful, elegant, lightweight and highly expressive language that lets you create effective code, whether you're managing object libraries or just trying to get Ajax to run fast. If you develop sites or applications for the Web, this book is an absolute must.

Product Details

  • Amazon Sales Rank: #10744 in Books
  • Brand: imusti
  • Published on: 2008-05
  • Original language: English
  • Number of items: 1
  • Dimensions: 9.19" h x .38" w x 7.00" l, .64 pounds
  • Binding: Paperback
  • 176 pages


  • O Reilly Media

Editorial Reviews

About the Author

Douglas Crockford is a Senior JavaScript Architect at Yahoo!, well known for introducing and maintaining the JSON (JavaScript Object Notation) format. He's a regular speaker at conferences on advanced JavaScript topics, and serves on the ECMAScript committee.

Customer Reviews

Most helpful customer reviews

598 of 611 people found the following review helpful.
5Wish I had this book when I first started Javascript
By Frodo Baggins
Do you struggle when creating objects in Javascript?
Do you find the syntax to be non-intuitive and frustrating?
Do you know the difference between using a function as an object vs using an object literal?
Do you know how using object literals can simplify your code and create something similar to namespaces?
Do you know how to augment the type system -- for example, if wanted all strings to have a trim() method?
Do you know why the "new" statement is so dangerous? Do you know an alternative that eliminates the use of "new" entirely?

These are some of the topics that the book touches upon.

This book is aimed at someone with intermediate programming experience that wants to know the best way to create and use objects, arrays, types, etc. Crockford takes his experience with Javascript to show you best practices coding techniques and styles to use with Javascript. In addition, the book provides insights into what makes Javascript so confusing and what can be done about it.

You might ask "Isn't this stuff already covered in other books that I have?" The answer is no. For one, most other books use a psuedo-classical coding style (see below) to explain objects that is a source of confusion.

Javascript can be very confusing, especially for programmers who have extensive experience in other C-based languages (like myself). Writing good Javascript that uses objects, methods, etc. is hard. In Javascript, if you want to create objects, use inheritance and create methods, you have several different ways to write your code and it's difficult to know what the strengths and weaknesses of each are.

Crockford explains the problem plainly. Other C-based languages use class inheritance (Crockford calls this classical inheritance). Javascript, on the other hand, is the only popular language that uses prototype inheritance, which does not have classes. However, the syntax which Javascript uses to create object is Java-like (Crockford calls this pseudo-classical syntax). It's confusing, because it keeps you in a class-based frame of mind while working in a language that has no concept of classes.

Clarifying what's going on with the object model is the best part of this book. Crockford also explains other parts of Javascript that can be problematic and the techniques that he prefers for handling them. I don't necessarily agree with all of them, but the important thing is that he explains his reasoning.

To effectively learn Javascript, I recommend that you buy 1) a book that covers the details of the language and can be used as a reference (e.g. Javascript, the Definitive Guide) and 2) Crockford's book. Advanced programmers might also enjoy Pro Javascript Design Patterns, which shows a number of ways to combine Javascript with some of the GoF patterns. I would avoid any cookbook style books on Javascript, because you're better off using YUI, JQuery or one of the other Javascript libraries than writing your own drag-and-drops, calendars, etc.

There are a series of Yahoo! videos by Crockford that mirror the material in this book and can be found as podcasts under YUI Theater. They contain nearly all of the material in the book and probably a little more. Those videos are:

- Douglas Crockford/An Inconvenient API: The Theory of the DOM (3 parts)
- Douglas Crockford/The JavaScript Programming Language (4 parts)
- Douglas Crockford/Advanced JavaScript (3 parts)
- Douglas Crockford/Javascript The Good Parts

10 of 10 people found the following review helpful.
5Classic JS book that every JS dev should read and reread.
By smc
This is one of the classic JS books that every JS developer should read.. and read multiple times. personally I think Ive read it about 4 times. There are lots of reviews on this book and just as many opinions about it. Regardless of all of those, you have to give Crockford the credit for helping to take JS to a new level that most JS devs were not thinking about at the time of its writing. There is a lot of "cowboy" coding in the JS world and this book was one of the first successful books to start defining *best practices* for JS coders. You will find the influence of this book in many other resources and software tools and undoubtedly tech discussions that you get in. The book is opinionated on some things and I get it that this bothers some people. If it bothers you then I say, "Have the sense of a cow... eat the hay and leave the sticks"... then read it again in a year and see if your opinion changes. Definitely a MUST READ for any JS dev.

5 of 5 people found the following review helpful.
5For me this book is perfect. I have a lot of experience developing production ...
By Bruce
For me this book is perfect.

I have a lot of experience developing production applications using C/C++ in the past. I started learning JavaScript and found it easy to get started with. The online tutorials do a good job of exposing the syntax and basic concepts. Javascript is not interpreted C/C++, I found that it more resembled LISP the way it was used. I was definitely confused by the language (what is with all this function within a function stuff?) and I wanted to understand how the language works (literally how it is implemented).

Douglas clarified the concepts for me and now I feel more confident understanding how to use JavaScript. Also, he points out some major pitfalls, e.g. understanding how Arrays work is key to using them.

This book is NOT for beginners to programming.
This book is very opinionated on what the core language constructs are and how to use them and avoid the other parts.
This book is small but quite dense. I must have re-read some sections 5-6 times along with gathering other sources and running through some online examples. Probably depends on your background and level of experience with JavaScript but the concepts were pretty new to me.
Chapters 4&5 really get to the meat of JavaScript.
The book is an excellent reference and recommend owning it if you want to do serious programming with JavaScript.

Also, you can find Crockford on youtube quite easily. I went through his excellent series here:


Update: Note: I have purchased 3 O'Reilly books in the last couple of months. Each one of them has literally fallen apart. I will be reading a page and the page will come out of the binding. I am fairly gentle on the books so I think there is a binding problem at O'Reilly.

See all 568 customer reviews...

Connect with defaultLogic
What We've Done
Led Digital Marketing Efforts of Top 500 e-Retailers.
Worked with Top Brands at Leading Agencies.
Successfully Managed Over $50 million in Digital Ad Spend.
Developed Strategies and Processes that Enabled Brands to Grow During an Economic Downturn.
Taught Advanced Internet Marketing Strategies at the graduate level.

Manage research, learning and skills at defaultLogic. Create an account using LinkedIn or facebook to manage and organize your IT knowledge. defaultLogic works like a shopping cart for information -- helping you to save, discuss and share.

  Contact Us