JavaScript course menu
Introduction to JavaScript: What It Is, Where It Runs and Why Learn It
A beginner-friendly introduction to JavaScript: what the language is, how it makes web pages interactive, where it runs (browsers, Node.js, mobile and desktop apps), how it relates to HTML, CSS, Java and TypeScript, and what you will learn in this course.
On this page
JavaScript is the programming language of the web. Every major browser can run it, and it is what makes web pages interactive: menus that open, forms that check your input as you type, maps you can drag, feeds that load more posts as you scroll. Today it also runs on servers, in mobile and desktop apps, and in command-line tools.
A first look#
Here is a small JavaScript program and what it prints:
const name = "Asha";
const lessons = 12;
console.log(`Hello, ${name}!`);
console.log(`You have finished ${lessons} lessons.`);Hello, Asha!
You have finished 12 lessons.And here is JavaScript working with a web page. Click the button:
<button id="like">Like</button>
<span id="count">0 likes</span>let likes = 0;
document.getElementById("like").addEventListener("click", () => {
likes += 1;
document.getElementById("count").textContent = `${likes} likes`;
});HTML, CSS and JavaScript#
If you have not learned HTML and CSS yet, the HTML course and CSS course are a good start, but the first sections of this course only need JavaScript itself.
Where JavaScript runs#
Because it runs in so many places, JavaScript is one of the most widely used programming languages, and it is required for front-end, full-stack and web developer roles. See the Web Developer path.
A little history#
JavaScript was created at Netscape in 1995 to add interactivity to web pages. The language is standardized under the name ECMAScript (often shortened to ES), and a new edition has been published every year since 2015. When people say "ES6" or "ES2015", they mean the big 2015 update that added let, const, arrow functions, classes, modules and promises.
JavaScript is not Java#
Despite the name, JavaScript and Java are different languages with different designs. The similar name was a marketing decision in the 1990s. If you know Java, some syntax (if, for, curly braces) will look familiar, but types, objects and how code runs are very different.
JavaScript and TypeScript#
TypeScript is JavaScript with added type annotations, which catch many mistakes before the code runs. It compiles to plain JavaScript. Learn JavaScript first; then the TypeScript course builds on it.
What you will learn#
- Fundamentals: variables, types, strings, numbers and operators.
- Control flow: conditions and loops.
- Functions: parameters, arrow functions, scope, closures and callbacks.
- Arrays, objects, Map and Set, JSON and dates.
- The DOM and events: making real web pages interactive.
- Asynchronous code: the event loop, promises, async/await and fetching data from APIs.
- Advanced topics: errors, classes,
this, prototypes, modules, generators and regular expressions. - JavaScript on the server with Node.js and npm.
Key takeaway#
Finished this lesson?