What Is JavaScript?
Objectives
By the end of this chapter, you should be able to:
- Explain what JavaScript is used for
- Explain where JavaScript code runs
- Recognize what ECMAScript (ES6+) means when you see it
💡 Why this matters: Every lesson after this one assumes you know what JavaScript actually is and where your code will run.
What Is JavaScript?
JavaScript is a programming language originally built to make web pages interactive: reacting to clicks, updating content without reloading the page, validating a form before it’s submitted. Today it also runs outside the browser, most commonly through Node.js, which lets you use JavaScript to write server code, scripts, and command-line tools.
This course focuses on the language itself, the part that’s identical everywhere JavaScript runs. A later course covers using it inside a browser.
Where JavaScript Runs
A JavaScript engine is the program that actually reads your code and executes it. Every browser has one built in (Chrome and Node both use Google’s V8 engine, Firefox uses SpiderMonkey, Safari uses JavaScriptCore). Node.js takes Chrome’s V8 engine and packages it to run outside the browser, which is why the same JavaScript syntax works in both places.
You’ll write and run code directly in your browser for this course, no separate install required. The next lesson shows you how.
ECMAScript and “ES6”
JavaScript follows a language specification called ECMAScript. When you see “ES6” or “ES2015” (the same thing, two names for one release), it refers to a major update that added features still central to how JavaScript is written today, including let, const, and arrow functions.
// Older style (still valid, but not what modern code looks like)
var name = "Erin";
// ES6+ style, what you'll use throughout this course
const name = "Erin";
You don’t need to memorize version numbers. Just know that “ES6+” means “modern JavaScript,” and that’s what this course teaches.
Try It
- In your own words, write one sentence explaining what JavaScript is used for.
- Name one place JavaScript runs besides a web browser.
Recap
- JavaScript began as a browser language and now also runs outside the browser through Node.js.
- A JavaScript engine is what actually executes your code. Browsers and Node both use one.
- “ES6+” means modern JavaScript syntax, which is what this course teaches.
Next lesson: setting up your environment and running your first script.