Customer Service 1-800-221-5528

Murach’s Modern JavaScript

by Mary Delamater
16 chapters, 608 pages, 242 figures
Published March 2024
ISBN 978-1-943873-14-2
List price: $59.50

This book helps your students learn JavaScript more easily than ever. From the basics to advanced skills, your students will learn the best practices of modern JavaScript. This book is ideal for students without previous programming experience who need detailed explanations, but it also works well for students who already know another language and are ready to move more quickly. Either way, when your students are done with your course, they’ll have the modern JavaScript skills that are in such demand today.

The only prerequisite for this book is a basic understanding of HTML and CSS.

Now available as a Canvas course!

The Canvas course file contains all the objectives, quizzes, assignments, and slides that you need to run an effective course. It only takes a few clicks to import it into the Canvas LMS. Then, you can customize it for your course. Learn more.

Our students always give feedback on their end-of-course evaluations that Murach textbooks are so well organized and easy to follow, with plenty of code examples, figures, and instructions."

Roger Fang, CIS Instructor
Arkansas Tech University, Russellville, Arkansas

  • About this Book
  • Table of Contents
  • Courseware
  • FAQs
  • Corrections

Book description

To present the JavaScript skills that your students need in a manageable progression, this book is divided into three sections. Each section represents a level of expertise that your students will achieve.

Section 1: Get started fast

Section 1 gets your students started fast with a seven-chapter course in JavaScript basics. This section works for programming beginners as well as for students with some programming experience because the pace is adjustable. Beginners can read each chapter carefully and do all the exercises. Students with some programming experience can move more quickly and do just the exercises that you assign. Either way, when they finish this section, your students will be developing simple but useful real-world JavaScript apps that add functionality to a web page by scripting the DOM.

Section 2: Master the essential skills

Section 2 presents the rest of the essential skills that your students should have. This includes validating data, saving data in the browser, and working with dates, times, and timers. In addition, this section shows your students how to use object-oriented programming to organize their code by defining their own objects and using ES modules.

Section 3: More skills as you need them

If you have time in your course, you can use the chapters in this section to raise your student’s JavaScript skills to a higher level of expertise. These chapters show how to:

  • Use Ajax to asynchronously update a web page without reloading the entire page.
  • Use Node.js to create a web-based API that manages data on a server.
  • Use the HTML <canvas> element to create drawings and animations.

What courses this book can be used for

This book has been carefully designed to be adaptable for any type of JavaScript course. Here’s how our book can work for two common types of of JavaScript courses:

JavaScript as a first language

Because section 1 is designed for students with a basic understanding of HTML and CSS but no programming experience, this book can be used for a first course in programming for web developers. Then, after your students complete that section, you can take them as far as time permits by assigning chapters from sections 2 and 3.

JavaScript as a second language

If your students have experience with another language, they’ll be able to move quickly through section 1 of our book. Then, you can work your way through the chapters in sections 2 and 3, either in sequence or in any order that makes sense for your course.

Recommended software

To develop JavaScript apps, this book recommends that your student use the following software. All of this software is available for free. And appendixes A (Windows) and B (macOS) provide complete, step-by-step instructions that your students can use to install it on their systems.

Visual Studio Code

This popular code editor is free and provides many excellent features for developing JavaScript apps.

Google Chrome

This web browser provides excellent developer tools for debugging JavaScript apps.

Node.js

This runtime environment makes it possible to run JavaScript on a server instead of running it in a web browser.

Related books

HTML and CSS

Murach's HTML and CSS begins by presenting an eight-chapter crash course that teaches your students HTML and CSS at a professional level, including a chapter on Responsive Web Design. That’s followed by three sections that can be taught in whatever sequence works best for your course.

So, if your students take an HTML and CSS course before they take the JavaScript course, we hope you’ll consider using both of our books for the series. They’re designed to work together seamlessly in a two- or three-course sequence. They both use our unique didactic methods so your students will learn more in less time. And they teach your students the most important HTML, CSS, and JavaScript skills that are actually used on the job.

JavaScript and jQuery

If you need to teach both JavaScript and jQuery, we hope you’ll consider using Murach's JavaScript and jQuery. This book is similar to Murach’s Modern JavaScript in many ways, but it integrates coverage of jQuery, an influential JavaScript library that has been around since 2006 and is still used extensively in millions of websites.

What people have said about our previous JavaScript books

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

"If you are new to web design or an old pro like me, this book is a must-have in my opinion. 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/designer.
“I have not seen a better book on the subject. This one will be on my desk for a while!"
- Shawn Jackson, Web Developer, Colorado

From Dr. Dobb’s Must-Have Books for JavaScript: “The aim of the book is to teach jQuery in an intensely hands-on way. It succeeds in this and probably provides the fastest way to learn and master the framework.”
- Andrew Binstock, Editor-in-Chief, Java Magazine

"An essential characteristic of this book, as well as the other Murach books, is that the examples, programs, and applications are all thoroughly tested. This book will work WONDERFULLY to help you build better and more robust websites!"
- Marvin Schneider, Instructor, New York

“I just finished a pretty heavy application project, the first serious work I have done with jQuery and Ajax. Along the way, I had to deal with preloading images, manipulations of the DOM, tabs, plugins, and Dialogs…. I kept this book at my side throughout the entire project, and it was indispensable. The answers were right there at every turn. All the examples made sense to me, and they all worked!”
- Alan Vogt, ETL Consultant, Information Builders, Inc.

“What I like about this and other Murach books is that within minutes of opening the book, you are developing hands-on with the technology in question.”
- Charles Zimmerman, Developer

View the table of contents for this book in a PDF: Table of Contents (PDF)

Click on any chapter title to display or hide its content.

Section 1  Get started fast

Chapter 1  How to code and run your first apps

An introduction to web apps and JavaScript

How JavaScript is used for client-side processing

ECMAScript version history

How to use VS Code to work with existing web apps

How to work with folders

How to work with files

How to install the Open in Browser extension

How to run an app

How to use VS Code to develop new web apps

How to create and run an app

How to enter and edit code

How to find and fix syntax errors

The Die Roller app

How to test a web app

How to use a browser to run an app

How to use your browser to find and fix runtime errors

The components of a web app

The HTML

The CSS

The JavaScript

Chapter 2  How to get started with JavaScript

How to get started

An introduction to coding statements

How to code comments

Three primitive data types

How to declare and initialize variables

How to declare and initialize constants

Rules and recommendations for naming variables and constants

How to work with numbers

How to code arithmetic expressions

How to use arithmetic expressions in statements

How to use the console to test expressions and statements

How to display data in the console

How to use the typeof operator

How to fix a precision problem

How to use the Math object

How to work with strings

How to join strings

How to include special characters in strings

How to get input and display output

How to use dialogs

How to parse numbers

Two simple apps

The Miles to Kilometers app

The Test Scores app

Chapter 3  How to code control statements

How to code conditional expressions

How to use the relational operators

How to use the isNaN() function

How to use the logical operators

How to get started with the selection structure

How to code an if statement

How to code a nested if statement

The Guess the Number app

More skills for working with the selection structure

How to use a non-Boolean value in a conditional expression

How to use the conditional operator

How to code a switch statement

The Magic Eight Ball app

How to code the iteration structure

How to code while and do-while loops

How to code for loops

How to use the break and continue statements

The Future Value app

Chapter 4  How to work with arrays and strings

How to get started with arrays

How to create and use an array

How to add, replace, and delete array elements

How to use a for loop with an array

How to use for-in and for-of loops with an array

The Test Scores app

More skills for working with arrays

How to modify or copy an array

How to inspect or transform an array

The Test Scores 2.0 app

More skills for working with strings

How to inspect a string

How to modify a string

How to create an array from a string

How to chain method calls

The Email Check app

The Bio app

Chapter 5  How to code functions and handle events

Three ways to work with functions

How to work with a function declaration

How to work with a function expression

How to work with an arrow function

The Future Value app

More skills for working with functions

How to work with scope

How to work with default parameters

How to work with the rest and spread operators

The Bio app

How to handle events

How to work with events

How to attach events to HTML elements

The Guess the Number app

How to work with the Event object

The Typewriter app

Chapter 6  How to script the DOM

How to get started with DOM scripting

DOM scripting concepts

How to get elements

How to script elements

How to script element attributes

More skills for scripting attributes

How to script the class attribute

The FAQs app

How to script forms and controls

How forms work

How to script text boxes, text areas, and select lists

How to script radio buttons and check boxes

How to use methods and events with forms and controls

The Register app

How to modify the DOM

How to add, replace, and delete nodes

The updated Register app

How to work with images

How to create an image object

How to preload images

The Image Swap app

Chapter 7  How to test and debug an app

An introduction to testing and debugging

The Future Value app

Three types of errors

Common JavaScript errors

How to plan the test runs

How to debug with Chrome’s developer tools

How to find errors

How to set breakpoints

How to step through code

Other debugging techniques

How to trace code execution

More methods for tracing execution

How to view the HTML and CSS for a web page

Section 2  Master the essential skills

Chapter 8  How to work with dates, times, and timers

How to work with dates and times

How to create Date objects

How to use the methods of a Date object

How to format dates

How to perform calculations on dates

The Countdown app

How to work with timers

How to use a one-time timer

How to use an interval timer

The Clock app

The Timer app

The Slide Show app

Chapter 9  How to work with data validation and exceptions

How to use HTML data validation

How to use input controls for data validation

How to use attributes for data validation

An introduction to regular expressions

The Register app

How to customize HTML validation

How to validate an element or a form

How to create custom validation

The Register app 2.0

How to work with exceptions

How to use try-catch statements

How to create and throw exceptions

The Future Value app

Chapter 10  How to work with web storage

An introduction to cookies and web storage

An introduction to cookies

How cookies compare to web storage

How to get started with web storage

How to work with local storage

How to work with session storage

How to use the nullish coalescing operator

The Future Value app

More skills for working with web storage

How to convert an object to JSON and back

How to use Chrome to work with stored items

The Task List app

Chapter 11  More skills for working with arrays

More methods of an array

How to inspect an array

How to sort elements

How to work with each element in an array

How to filter, map, and reduce elements

The Test Scores app

Advanced skills for working with arrays

How to destructure an array

How to create and use an array of arrays

How to loop through an array of arrays

How to sort an array of arrays

How to flatten an array of arrays

The Task List app

How to copy an array

How to make a shallow copy

How to make a deep copy

Chapter 12  How to work with objects

How to get started with objects

How to use an object literal to define an object

How to use a class to define an object

How to work with objects

How to create and use JavaScript libraries

The Invoice app

How to work with encapsulation

How to work with private properties and methods

How to work with accessor properties

How to work with inheritance and object composition

How to work with inheritance

When to use inheritance

When to use object composition

The Trips app

More skills for working with objects

How to create cascading methods

How to work with static properties and methods

How to nest objects

How to destructure an object

How to work with generator functions

The Task List app

Chapter 13  How to work with modules

How to work with ES modules

How to export and import module items

How to declare a script as a module

The Slide Show app

More skills for working with modules

How to rename exports and imports

How to export and import classes

How to create a default export

How to work with import maps

The Task List app

The Clock app

Legacy skills for working with modules

How closures work

The module pattern

Section 3  More skills as you need them

Chapter 14  How to work with Ajax

Introduction to Ajax

How Ajax works

Two common data formats for Ajax

How to make an Ajax request

The JSON Placeholder API

How to use the Fetch API for GET requests

How to use the Fetch API for POST, PUT, and DELETE requests

How to use the async and await keywords

The Astronomy Picture of the Day app

How to use asynchronous code in a module

How to export an asynchronous function

How to use a top-level await

The User Directory app

How to make cross-origin requests

Chapter 15  How to work with Node.js

How to use the node command

How to interactively test code

How to run a script

How to pass arguments to a script

How to work with Node.js modules

How to use ES and CommonJS modules

How to use the built-in file system module with promises

How to create and use your own module

How to work with NPM modules

How to install NPM modules

How package.json files work

How to use Express to create a web-based API

How to start an Express app for an API

How to set up a route for a GET request

How to set up routes for POST, PUT, and DELETE requests

The Email List API

The CORS Proxy API

Chapter 16  How to work with drawing and animation

An introduction to the Canvas API

How the Canvas API works

How to provide for accessibility

How to draw rectangles and text

How to draw rectangles

How to draw text

The Tic Tac Toe app

How to draw lines

How to work with paths

The Drawing app

How to draw circles and colors

How to draw circles and arcs

How to draw colors

The Smiley Face app

How to create animations

How to use the requestAnimationFrame() method

The Pong app

How to work with the HTML Drag and Drop API

How to drag and drop an HTML element

The Movie List app

Resources

Appendix A  How to set up Windows for this book

How to download the files for this book

How to install Chrome

How to install Visual Studio Code

How to install Node.js and the http-server module

How to test an app on a local web server

Appendix B  How to set up macOS for this book

How to download the files for this book

How to install Chrome

How to install Visual Studio Code

How to install Node.js and the http-server module

How to test an app on a local web server

If you aren’t familiar with the supporting materials that we provide for our books, please visit the About our Courseware page to learn what we provide and how each component can work for you and your students.

If you’re already familiar with our supporting materials from other books, here’s a quick summary of the courseware available for this book.

End-of-chapter activities in the book

  • Terms list
  • Exercises

Student download

  • Complete code for every app presented in the book
  • Starting code for the exercises at the end of each chapter
  • Solutions to those exercises

Appendixes A (Windows) and B (macOS) give your students instructions for downloading these files.

Instructor’s materials

  • Instructional objectives
  • PowerPoint slides
  • Test banks
  • Projects for student practice and evaluation
  • Case studies for more extensive practice and evaluation

We provide the files for all of these materials in a zip file. After unzipping this file, you can import these materials into any LMS.

We also provide a Canvas course file that contains most of these files. If you’re using the Canvas LMS, you can use this file to import these materials with just a few clicks.

On this page, we’ll be posting answers to the questions that come up most often about this book. So if you have any questions that you haven’t found answered here at our site, please email us. Thanks!

There are no book corrections that we know of at this time. But if you find any, please email us, and we’ll post any corrections that affect the technical accuracy of the book here. Thank you!

Murach college books and courseware since 1974