My Cart (0)

Customer Service 1-800-221-5528

Murach’s JavaScript (2nd Edition)

by Mary Delamater
17 chapters, 630 pages, 259 illustrations
Published September 2015
ISBN 978-1-890774-85-1
Print: $54.50
eBook: $49.50
Print + eBook: $67.00

This book is intended for client-side programmers who want to master JavaScript, from the basics all the way through expert-level skills like working with closures, callbacks, namespaces, modules, custom properties, and JSON. Since this is more than most developers need to know, we also offer Murach’s JavaScript and jQuery. It not only presents the JavaScript skills that all web developers should have, but also the jQuery skills that they should have. 

College Instructors

Go to our instructor’s site to learn more about this book and its instructor’s materials.

If you are new to web design or an old pro like me, this book is a must-have. I love how it starts out with the basics and then moves on to the good stuff. Each chapter is full of examples and sample code showing you how to do the most common techniques that you will face as a web developer or designer. I have not seen a better book on the subject."

Shawn Jackson, Web Developer

  • About this Book
  • Table of Contents
  • FREE Downloads
  • Book FAQs
  • Corrections
  • Reviews

What this book does

To present the JavaScript skills that you need in a manageable progression, this book is divided into three sections. These sections represent the three levels of expertise that you’ll develop with this book.

Section 1: Get off to a fast start with JavaScript

  • Section 1 presents a six-chapter course in JavaScript that gets you off to a great start. This section works for programming novices as well as experienced programmers because it lets you set your own pace. If you’re a beginner, you’ll move slowly and do all the exercises. If you have some experience, you’ll move more quickly and do the exercises that you choose. When you finish this section, you’ll be able to develop real-world JavaScript applications of your own.

Section 2: Master the JavaScript essentials

  • Section 2 presents the essential JavaScript skills that every web developer should have. The six chapters in this section not only expand upon what you’ve learned in section 1, but they also present new skills, like how to use arrays, web storage, and JavaScript libraries...how to create object-oriented JavaScript applications... how to handle exceptions...and how to use regular expressions.

Section 3: Take your skills to the expert level

  • When you’re ready to take your skills to the expert level, section 3 presents the advanced skills that you’re going to need. These include skills like how to work with events, images, and timers as you build applications like slide shows...how to use closures, callbacks, namespaces, and the module pattern to make your applications bulletproof...and how to use JSON to transmit and store data. This section finishes with an introduction to jQuery that shows you how it can make your JavaScript code even better.

Why you’ll learn faster and better with this book

Like all our books, this one has features that you won’t find in competing books. That’s why we believe you’ll learn faster and better with our book than with any other. Here are a few of those features.

  • This book is designed to teach you the skills you’re going to need on the job without wasting your time on skills that you aren’t likely to use. That sounds simple, but most JavaScript books either overwhelm you with information that you’ll never need or trivialize the subject by avoiding all of the complications. For instance, this book shows you enough about DOM scripting with JavaScript that you know the basics, but it doesn’t go much beyond that since you should use jQuery for most of your DOM scripting.
  • To show you how JavaScript works, this book presents more than 30 complete JavaScript applications that range from the simple to the complex. We believe that studying the program code for complete applications is still the best way to learn a new language. And we think that this is the missing ingredient in most JavaScript books.
  • Of course, this book also presents dozens of short examples, so it’s easy to find an example that shows you how to do what you want to do. Even better, our paired pages make it much easier to find the example that you’re looking for than it is with traditional books in which the examples are embedded in the text.

Who this book is for

This book is for anyone who wants to develop a complete set of JavaScript skills. That includes:

  • Web designers who use HTML and CSS and would like to build applications with JavaScript.
  • Server-side programmers who use languages like ASP, JSP, or PHP and would like to add JavaScript programming to their skillsets.

What software you need

To develop JavaScript applications, you need:

  • any text editor
  • Google Chrome along with the default browser on your system: Internet Explorer for Windows users and Safari for Mac OS

Although you can use any text editor with this book, a text editor that includes syntax coloring and auto-formatting will help you develop applications more quickly and with fewer errors. In the book, we recommend Aptana Studio 3; however, it’s no longer supported and has become hard to install.

So now, we recommend Brackets. It’s available for free, it can be used for entering JavaScript and jQuery code (as well as HTML and CSS code), and it runs on Windows, Mac OS, and Linux systems. To help you install and get started with it, we’ve created a Brackets tutorial that you can download here or from the FREE Downloads tab.

To test a web page, you can use the default browser on your system. But we recommend that you also test your pages in Chrome, which includes a terrific set of developer tools. Appendix A provides a procedure for installing Chrome, and chapter 6 shows you how to use Chrome for debugging.

What's new with ECMAScript 2015 and 2016

Because this book was published in 20156, it doesn’t present all of the new features that are in the ECMAScript 2015 and 2016 specifications. If you want to learn how to use those features, though, we offer a FREE PDF called “What’s new with ECMAScript 2015 and 2016” that presents all of the new features plus the Internationalization API. This PDF is both tutorial and reference, and you can get this download by going to the FREE Downloads tab on this page.

Companion books

Murach’s HTML5 and CSS3 (4th Edition)

Murach’s HTML5 and CSS3 is the perfect companion to our JavaScript and jQuery books because it shows how to build web pages with the HTML5 and CSS3 that is used by JavaScript and jQuery. When you combine this book with our JavaScript and jQuery books, you’ll have a complete reference set for building web pages.

What people say about this book

“If you are new to the use of JavaScript or need a reference to keep close at hand, this is the book for you. It will take you through the basics and to mid-level in 17 chapters.”
- Eric Notheisen, Enterprise Developers Guild

“I have several books on JavaScript, but the best one is this one. The text, examples, descriptions, and even the layout all bring you an ease of use that is missing in other books.”
- Chris Wallace, Denver Visual Studio User Group

“There are a plethora of source code examples that are introduced and improved as new concepts are introduced. An excellent resource for newbies and experienced developers.”
- Mike Redlich, ACGNJ Java Users Group

“This book more clearly teaches JavaScript than any other book that I have seen.
     “One of its strengths is the examples it uses to teach JavaScript. It contains complete examples of HTML, CSS, and JavaScript code. In those example codes, the authors clearly highlight which elements are referenced in the different parts of the JavaScript. This book allows the reader to develop a clearer understanding of how each JavaScript component works without ambiguity.”
- Eric Mortensen, Northeast Ohio Oracle Users Group

“This book employs the paired-pages format that Murach is known for: For each topic the right page contains a figure with example code, diagrams, tables and bullet points, and the left page contains the explanatory text. I like this format a lot because it keeps the book well-organized and makes it easy to refer back to….
     “The paired-pages format and the end-of-chapter exercises are the main reasons why I use and recommend Murach books for people looking to learn a new technology.”
- Bruce Alspaugh, St. Louis Java Users Group

“Comparing Murach's Javascript to the six or seven other Javascript books I've bought in the past three years, I think it has the best blend of practicality, coverage, and clarity.”
- Posted at Amazon

To view the table of contents for this book in a PDF, just click on the link below:

Table of Contents

Section 1 Get off to a fast start with JavaScript

Chapter 1 Introduction to web development

How a web application works

The components of a web application

How static web pages are processed

How dynamic web pages are processed

How JavaScript is used for client-side processing

What you need to know about the ECMAScript specification

The components of a JavaScript application

The HTML

The CSS

The JavaScript

The HTML skills that you need for this book

How to use the HTML5 semantic elements

How to use the div and span elements

How to use the basic HTML attributes

The CSS skills that you need for this book

How to provide the CSS styles for an HTML page

How to code the basic CSS selectors

How to code CSS rule sets

How to test a JavaScript application

How to run a JavaScript application

How to find errors in your code

How to provide cross-browser compatibility

How to use Aptana to develop JavaScript applications

How to create or import a project

How to work with files

How to edit a file

How to run a JavaScript application

Chapter 2 Getting started with JavaScript

How to include JavaScript in an HTML document

Two ways to include JavaScript in the head of an HTML document

How to include JavaScript in the body of an HTML document

The JavaScript syntax

How to code JavaScript statements

How to create identifiers

How to use comments

How to use objects, methods, and properties

How to use the write and writeln methods of the document object

How to work with JavaScript data

The primitive data types

How to code numeric expressions

How to work with numeric variables

How to work with string and Boolean variables

How to use the parseInt and parseFloat methods

Two illustrative applications

The Miles Per Gallon application

The Test Scores application

Chapter 3 The essential JavaScript statements

How to code the basic control statements

How to code conditional expressions

How to code if statements

How to code while and do-while loops

How to code for loops

Three illustrative applications

The enhanced Miles Per Gallon application

The Future Value application

The enhanced Test Scores application

How to work with arrays

How to create and use arrays

How to use for loops to work with arrays

The Test Scores application with an array

The user interface

The JavaScript

Chapter 4 How to work with JavaScript objects, functions, and events

How to use objects to work with data

How to use the window and document objects

How to use Textbox and Number objects

How to use Date and String objects

How to use the DOM to change the text for an element

How to use functions

How to create and call a function expression

How to create and call a function declaration

When and how to use local and global variables

When and how to use strict mode

How to handle events

How to attach an event handler to an event

How to use an onload event handler to attach other event handlers

Two illustrative applications

The Miles Per Gallon application

The Email List application

Chapter 5 How to script forms and controls

DOM scripting properties and methods

DOM scripting concepts

The properties of the Node interface

The methods of the Document and Element interfaces

The properties of the DOM HTML specification

The FAQs application

The HTML and CSS

The JavaScript

How to script forms and controls

How forms work

How to script Textbox, Textarea, and Select objects

How to script Radio and Checkbox objects

How to use the methods and events for forms and controls

The Register application

The HTML and CSS

The JavaScript

How to add new nodes to the DOM

How to create nodes and add them to the DOM

How to add rows and cells to a DOM table

The Register application with a table

The HTML and CSS

The JavaScript

Chapter 6 How to test and debug a JavaScript application

An introduction to testing and debugging

Typical test phases for a JavaScript application

The three types of errors that can occur

Common JavaScript errors

How top-down coding and testing can simplify debugging

How to debug with Chrome’s developer tools

How to use Chrome to find errors

How to use breakpoints and step through your code

Other debugging methods

How to debug in Internet Explorer

How to trace the execution of your JavaScript code

How to view the source code

When and how to validate the HTML

Section 2 JavaScript essentials

Chapter 7  How to work with numbers, strings, and dates

How to work with numbers

How to use the properties and methods of the Number object

How to use the methods of the Math object

How to generate a random number

The PIG application

The HTML

The JavaScript

How to work with strings

How to use escape sequences in strings

How to use the methods of the String object

Examples of working with strings

How to work with dates and times

How to create Date objects

The methods of the Date object

Examples of working with dates

The Count Down application

The HTML and CSS

The JavaScript

Chapter 8  How to code control statements

How to code conditional expressions

How to use the equality and identity operators

How to use the relational operators

How to use the logical operators

How to code the selection structures

How to code if statements

How to code switch statements

How to use the conditional operator

How to use the AND and OR operators for selections

The Invoice application

The HTML

The JavaScript

How to code the iteration structures

How to code while and do-while loops

How to code for loops

How to use the break and continue statements

Chapter 9 How to work with arrays and web storage

How to create and use an array

How to create an array

How to add and delete array elements

How to use for loops to work with arrays

How to use for-in loops to work with arrays

How to use the methods of an Array object

The methods of an Array object

Examples of the Array methods

The ECMAScript 5 methods

Examples of the ECMAScript 5 methods

Other skills for working with arrays

How to use a String method to create an array

How to create and use an associative array

How to create and use an array of arrays

How to use web storage

How to use local and session storage

How to use Chrome to view and edit items in web storage

The Task Manager application

The HTML and CSS

The JavaScript

The JavaScript with an ECMAScript 5 enhancement

Chapter 10 How to create and use functions

Basic skills for working with functions

How to create and call a function

How values are passed to functions

How lexical scope works

How to create and use JavaScript libraries

The Task Manager application

The HTML and CSS

The storage library

The task list library

The main JavaScript file

Object-oriented skills for working with functions

How to use the arguments property of a function

How to use the this keyword and the call and apply methods

How to use the bind method to set the this keyword

Chapter 11 How to create and use objects

Basic skills for working with objects

How to create and use the native object types

How to create your own objects with object literals

How to extend, modify, or delete an object

How to create your own object types with constructor functions

What you need to know about JavaScript prototypes

How prototypes work

When and how to create custom prototypes

How to use the create method of the Object object

The Task Manager application

The HTML and CSS

The storage library

The task library

The task list library

The main JavaScript file

Advanced skills for working with objects

How to inherit methods from another object with Object.create methods

How to inherit methods from another object with constructors

How to add methods to the native object types

How to create cascading methods

How to use the in, instanceof, and typeof operators

The enhanced Task Manager application

The new native objects library

The change to the task library

The enhanced storage library

The enhanced task list library

The enhanced main JavaScript file

Chapter 12 How to use regular expressions, handle exceptions, and validate data

How to use regular expressions

How to create and use regular expressions

How to create regular expression patterns

How to use the global and multiline flags

String methods that use regular expressions

Regular expressions for data validation

How to handle exceptions

How to create and throw Error objects

How to use the try-catch statement to handle exceptions

The Register application

The user interface

The HTML and CSS

The navigate and fields libraries

The validate library

The validate_form library

The main JavaScript code

Section 3 Advanced JavaScript skills

Chapter 13 How to work with events, images, and timers

How to work with events

An overview of event types

How to attach and detach event handlers

How to cancel the default action of an event

The FAQs application

The user interface

The event library

The main JavaScript file

How to work with images

How to create image rollovers

How to preload images

The Rollover application

The HTML

The main JavaScript file

How to use timers

How to use a one-time timer

How to use an interval timer

The Slide Show application

The HTML

The slideshow library

The main JavaScript file

Chapter 14 How to work with closures, callbacks, and recursion

Introduction to closures

How the scope chain works

How closures work

Closures in the Rollover application

How to use closures

How to use closures to create private state

How to code an immediately invoked function expression (IIFE)

How to use an IIFE to create block scope

How to solve the closure loop problem

How to work with the this keyword in closures

The Slide Show application

The HTML

The slide show library

The main JavaScript file

How to use callbacks

How callback functions work

How to create and use callback functions

How to work with the this keyword in callback functions

How to use recursion

How recursion works

How to code and use a binary search recursive function

The Task Manager application

The HTML

The storage library file

The task list library file

The main JavaScript file

Chapter 15 How to work with namespaces, modules, and custom properties

How to work with namespaces

The global namespace pollution problem

How to create and use namespaces

How to create nested namespaces and use aliases

How to prevent global pollution with an IIFE

The Task Manager application

The namespace library

The storage library

The task list library

The main JavaScript file

How to work with the module pattern

What the module pattern is

How to augment a module

The Slide Show application

The HTML

The slide show library

The slide show enhancements library

The main JavaScript file

How to customize properties

The attributes of an object property

How to enumerate an object’s properties

The defineProperty method of the Object object

How to use the defineProperty method

How to use the defineProperties and create methods of the Object object

How to inspect property attributes

The enhanced Slide Show application

The slide show library

The slide show enhancements library

The main JavaScript file

Chapter 16 How to work with JavaScript Object Notation (JSON)

An introduction to JSON

What data serialization and deserialization are

How data formats work

What JavaScript Object Notation (JSON) is

How to work with JSON in JavaScript

An introduction to the global JSON object

How to use the stringify method of the JSON object

How to use the parse method of the JSON object

The Task Manager application

The HTML

The JSON string in local storage

The main JavaScript file

How to customize the stringify method

How to use the toJSON method

How to use a toJSON method to customize the Task Manager application

How to use the replacer parameter of the stringify method

How to use the space parameter of the stringify method

The serialization order of the stringify method

How to customize the parse method

How to use the reviver parameter of the parse method

Some problems with checking if a string is a date

The enhanced Task Manager application

The JSON string in local storage

The storage library

The main JavaScript file

Chapter 17 When and how to use jQuery

Introduction to jQuery

What jQuery is

When to use jQuery

How to include jQuery in a web page

How to code jQuery selectors, methods, and event methods

Some common jQuery selectors, methods, and event methods

How to use jQuery to simplify the FAQs application

The Email List application in jQuery

The HTML

The jQuery

Introduction to jQuery UI

What jQuery UI is

How to include jQuery UI in a web page

How to use any jQuery UI widget

How to use the Accordion widget to implement the FAQs application

Introduction to jQuery plugins

How to find jQuery plugins

How to use any jQuery plugin

How to use the bxSlider plugin for carousels

How to create your own plugins

The structure of a plugin

How to code a plugin that highlights the items in a menu

How to add options to a plugin

Sample chapters

To get a better idea of how well this book works, you can download a chapter in PDF format. As you will see, the approach in this book works for programming novices as well as for experienced programmers.

Chapter 2: Getting started with the JavaScript language

This chapter uses two simple JavaScript applications to introduce you to the syntax and characteristics of the language. It’s designed to work for programming novices, so it starts your JavaScript training slowly. If you have programming experience, though, you’ll see how our paired-pages design and how-to headings allow you to speed through material you already know…and focus on features that are new to you.

And regardless of how much programming experience you have, you’ll see how the chapter exercises let you practice what you’ve learned in interesting ways.

Chapter 2 PDF (525Kb) Download Now

Book applications and exercises

This download includes:

  • The source code for the applications that are in the book
  • The starting source code for the exercises in the book
  • The solutions to the exercises in the book

Appendix A in the book shows how to install and use these files.

Exe file for Windows (6.2Mb) Download Now

Zip file for any system (6.2Mb) Download Now

Tutorial: How to use Brackets to develop applications

Murach’s JavaScript (2nd Edition) shows how to use Aptana as the text editor for developing JavaScript applications. Unfortunately, Aptana is no longer supported and has become difficult to install.

So our recommendation is to use Brackets instead. Developed by Adobe, Brackets is easy to install and use, has some excellent features, and runs on Windows, Mac OS, and Linux systems. So this tutorial shows you how to install and use it for JavaScript (as well as HTML and CSS) development.

Brackets Tutorial PDF (1.4MB) Download Now

What’s new in ECMAScript 2015 and 2016

This PDF summarizes the new JavaScript features that became available with the ECMAScript 2015 and 2016 specifications. This makes it easy for you to add the new skills to the skillset you developed by reading Murach’s JavaScript. Although you probably won’t want to use all of the new features, you’re sure to find a few that you’ll want to use. And after you’ve used this document for learning, it becomes a terrific on-the-job reference.

What's new PDF (335Kb) Download Now

To view the "Frequently Asked Questions" for this book in a PDF, just click on this link: View the questions

Then, if you have any questions that aren't answered here, please email us. Thanks!

To view the corrections for this book in a PDF, just click on this link: View the corrections

Then, if you find any other errors, please email us so we can correct them in the next printing of the book. Thank you!

Rob Spoor

Tuesday, 19 January 2016

The book follows the Murach style - on the left pages there is text, on the right pages there are screen shots, code snippets, and short summaries of the text on the left. For experienced programmers it's tempting to skip the entire left pages and focus on the right pages.

All in all I still think it's a pretty good book, with good examples, but it could have been better.

---
Disclosure: I received a copy of this book from the publisher in exchange for writing this review.

To leave a review, please log in to your account.     Log In Here

Our Ironclad Guarantee

You must be satisfied. Try our print books for 30 days or our eBooks for 14 days. If they aren't the best you've ever used, you can return the books or cancel the eBooks for a prompt refund. No questions asked!

Contact Murach Books

For orders and customer service:

1-800-221-5528

Weekdays, 8 to 4 Pacific Time

College Instructors

If you're a college instructor who would like to consider a book for a course, please visit our website for instructors to learn how to get a complimentary review copy and the full set of instructional materials.