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!
According to StackOverflow’s 2023 Developer Survey, JavaScript is the most popular language in the world. That’s because JavaScript is used by most websites, from small personal websites to the largest commercial sites.
In the old days, JavaScript was a difficult language to learn due to some quirky features in its early versions. But now, this book can help you learn JavaScript more easily than ever by skipping the confusing old features and jumping straight to the new features and best practices of modern JavaScript. When you finish this book, you’ll have the JavaScript skills that are in such demand today.
Go to our instructor’s site to learn more about this book and its instructor’s materials.
This is my first exposure to Murach's books, and I love them. I like the organization of the content, the consistent approach in each book, and the accuracy of the material."
This book is designed for anyone who wants to learn how to write JavaScript. Today, that includes:
To present the JavaScript skills that you need in a manageable progression, this book is divided into three sections. Each section represents a level of expertise that you will achieve.
Section 1 presents a seven-chapter course in JavaScript that gets you started fast. Because the pace is adjustable, this section works for those with no prior programming experience as well as for experienced professionals. Beginners can read each chapter carefully and do all the exercises. Professionals can skim over the parts they already know and focus on the differences with other languages. Either way, when you finish this section, you will be able to develop real-world JavaScript apps that script the DOM.
Section 2 presents the rest of the essential skills that any web developer should have. This includes validating data, saving data in the browser, and working with dates, times, and timers. In addition, this section shows how to use object-oriented programming to organize your code by defining your own objects and by using ES modules.
When you have time, you can use the chapters in this section to raise your JavaScript skills to a higher level of expertise. This section shows how to:
Like all our books, this book is designed to make it as easy as possible for you to learn new skills faster and retain them better. Here are a few of those features:
To develop JavaScript apps, this book recommends that you 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 you can use to install it on your system.
This popular code editor is free and provides many excellent features for developing JavaScript apps.
This web browser provides excellent developer tools for debugging JavaScript apps.
This runtime environment makes it possible to run JavaScript on a server instead of running it in a web browser.
We recommend our HTML and CSS book as an ideal companion book for our Modern JavaScript book. These two books are designed to work together seamlessly to teach you the HTML, CSS, and JavaScript skills that are actually used on the job.
If you need to learn jQuery, we recommend our JavaScript and jQuery book. This book is similar to 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.
“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!”
- Web Developer, Colorado
“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
“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 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
View the table of contents for this book in a PDF: Table of Contents (PDF)
Click on any chapter title below to display or hide its content.
How JavaScript is used for client-side processing
ECMAScript version history
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 create and run an app
How to enter and edit code
How to find and fix syntax errors
The Die Roller app
How to use a browser to run an app
How to use your browser to find and fix runtime errors
The HTML
The CSS
The JavaScript
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 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 join strings
How to include special characters in strings
How to use dialogs
How to parse numbers
The Miles to Kilometers app
The Test Scores app
How to use the relational operators
How to use the isNaN() function
How to use the logical operators
How to code an if statement
How to code a nested if statement
The Guess the Number app
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 while and do-while loops
How to code for loops
How to use the break and continue statements
The Future Value app
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
How to modify or copy an array
How to inspect or transform an array
The Test Scores 2.0 app
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
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
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 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
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 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 add, replace, and delete nodes
The updated Register app
How to create an image object
How to preload images
The Image Swap app
The Future Value app
Three types of errors
Common JavaScript errors
How to plan the test runs
How to find errors
How to set breakpoints
How to step through code
How to trace code execution
More methods for tracing execution
How to view the HTML and CSS for a web page
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 use a one-time timer
How to use an interval timer
The Clock app
The Timer app
The Slide Show app
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 validate an element or a form
How to create custom validation
The Register app 2.0
How to use try-catch statements
How to create and throw exceptions
The Future Value app
An introduction to cookies
How cookies compare to 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
How to convert an object to JSON and back
How to use Chrome to work with stored items
The Task List app
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
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 make a shallow copy
How to make a deep copy
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 private properties and methods
How to work with accessor properties
How to work with inheritance
When to use inheritance
When to use object composition
The Trips app
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
How to export and import module items
How to declare a script as a module
The Slide Show app
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
How closures work
The module pattern
How Ajax works
Two common data formats for Ajax
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 export an asynchronous function
How to use a top-level await
The User Directory app
How to interactively test code
How to run a script
How to pass arguments to a script
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 install NPM modules
How package.json files work
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
How the Canvas API works
How to provide for accessibility
How to draw rectangles
How to draw text
The Tic Tac Toe app
How to work with paths
The Drawing app
How to draw circles and arcs
How to draw colors
The Smiley Face app
How to use the requestAnimationFrame() method
The Pong app
How to drag and drop an HTML element
The Movie List app
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
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
See for yourself how this book can get you started fast with JavaScript development.
This appendix shows how to set up Windows for JavaScript development, including instructions for installing the required software and downloading the files for the book examples and exercises. When you’re done, you’ll be able to work through the examples and exercises presented in this book.
Download Now
This appendix shows how to set up macOS for JavaScript development, including instructions for installing the required software and downloading the files for the book examples and exercises. When you’re done, you’ll be able to work through the examples and exercises presented in this book.
Download Now
This chapter begins with the background concepts, terms, and skills you need to start using JavaScript to provide the functionality for a web page. Then, it presents a quick tutorial on using the popular Visual Studio Code editor to develop your first JavaScript apps. Finally, it shows the code for a JavaScript app that validates data the user enters on a web page.
Download Now
The goal of this chapter is to get you off to a good start with the JavaScript language, especially if you’re new to programming. If you have experience with another language, you can decide how rapidly you move through this chapter. Otherwise, you can read slowly and carefully, test the code as you go, and do each of the exercises at the end of this chapter to be sure you understand the material before moving on.
Download Now
This download includes:
Appendixes A (Windows) and B (macOS) show how to install and use these files.
Download Now
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. Thank you!
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!
For orders and customer service:
1-800-221-5528
Weekdays, 8 to 4 Pacific Time
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.