Head First JavaScript

Head First JavaScript

Available now!

So you're ready to make the leap from writing HTML and CSS web pages to creating dynamic web applications. You want to take your web skills to the next level. And you're finally ready to add "programmer" to the resume. It sounds like you're ready to learn the Web's hottest programming language: JavaScript. Head First JavaScript is your ticket to going beyond copying and pasting the code from someone else's web site, and writing your own interactive web pages.

With Head First JavaScript, you learn:
— The basics of programming, from variables to types to looping
— How the web browser runs your code, and how you can talk to the browser with your code
— Why you'll never have to worry about casting, overloading, or polymorphism when you're writing JavaScript code
— How to use the Document Object Model to change your web pages without making your users click buttons

If you've ever read a Head First book, you know what to expect—a visually rich format designed for the way your brain works. Head First JavaScript is no exception. It starts where HTML and CSS leave off, and takes you through your first program into more complex programming concepts—like working directly with the web browser's object model and writing code that works on all modern browsers.

Don't be intimidated if you've never written a line of code before! In typical Head First style, Head First JavaScript doesn't skip steps, and we're not interested in having you cut and paste code. You'll learn JavaScript, understand it, and have a blast along the way. So get ready... dynamic and exciting web pages are just pages away.

A collection of images from inside the book.

JavaScript: Hands On

Practice your JavaScript in this handy web interface.

Read Me: What you should know before reading this book

We teach JavaScript on a "need to know" basis.

If you're looking for a history of JavaScript, keep on looking because this book won't help. The goal here is to teach you how to do cool, practical things in JavaScript to amp up the interactivity of web pages, turning them into responsive web applications that people will want to experience. We forego formalities, and only teach the JavaScript concepts you need to know to do real things, in real time. Really.

We don't cover every hidden nuance of the JavaScript language.

While we could have put every single JavaScript statement, object, event, and keyword in this book, we thought you'd prefer a reasonably portable book that doesn't require a forklift to carry from your desk to the gym. Oh yeah, it's a great workout read, but you might want to invest in a sweat-proof pencil! We focus on the parts of JavaScript you need to know, the ones you'll use 95 percent of the time. And when you're done with this book, you'll have the confidence to go look up that elusive method you need to finish off that killer script you just dreamed up in the shower.

Since JavaScript includes a huge built-in library of reusable code, it's important to understand when you're dealing with standard JavaScript code, as opposed to custom code that you create. Any time you see the word "custom," that means the code is custom built by you, and not a built-in part of JavaScript.

We encourage you to use more than one browser with this book.

Even though all modern web browsers support JavaScript, there are sometimes subtle differences in how they handle certain JavaScript code. So, we encourage you to pick at least two up-to-date browsers and test your scripts using them. We've found Firefox to currently be a superior browser for helping track down JavaScript coding errors, but your scripts will ultimately need to run consistently on a variety of different browsers. Don't hesitate to get your friends, family members, co-workers, and highly trained pets to help test out your scripts in their browsers.

Code Viewing and Downloads

Download all the code in the book (zip)

All of the code is accompanied by a Read Me file in each folder that explains which part of the book each version corresponds to.

View and download the code by chapter:

Note to Windows users: Because these files were developed on a Mac, it may be necessary for you to open the files (at least the first time) with WordPad in order for the line breaks to display properly.

Selected Review Quotes

"Head First JavaScript is one of the latest entries in O'Reillys Head First series. Like the other Head First books, it takes a somewhat unique approach in conveying information. The stated intent of the series is to help readers learn and retain material by formatting it in a manner that assists in meeting those goals. This means that the book is full of graphics, exercises and humor. There is also a refreshing note on who will benefit from the book. I've pretty much always thought of these sections in books as entertaining, in that I get to see what new way a publisher has found to say, "Everyone should buy this book!". Head First Javascript actually does a decent job of describing who this book will help, and who it will not help. That alone had me intrigued right from the start."
(opens a new window)

Read it on Safari

(opens a new window)

Buy 2 books, get 1 free!

Buy 2 books and get the third free! Use the coupon code OPC10 when you check out.

Who is this book for?

If you can answer "yes" to all of these:

  • Do you have access to a computer with a web browser, a text editor, and an Internet connection?
  • Do you want to learn, understand, and remember how to create web pages that are alive with energy, turning the Web into a truly interactive experience?
  • Do you prefer stimulating dinner party conversation to dry, dull, academic lectures?

You should probably back away from this book if you can answer "yes" to any of these:

  • Are you completely new to creating web pages? (You don't need to be an HTML guru, but you should understand the basics of how web pages go together with HTML and CSS, and how to post them online.)
  • Do you hold a ninth degree black belt in Script Fu, and are really looking for a JavaScript reference book?
  • Are you afraid to try something different? Would you rather have a root canal than mix stripes with plaid? Do you believe that a technical book can't be serious if JavaScript code is anthropomorphized?


Ask the authors questions and chat with fellow readers in the Head First JavaScript Forum.