Skip to content
Laviyx Learn

Try

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.

Beginner4 min readUpdated
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:

JavaScript
const name = "Asha";
const lessons = 12;

console.log(`Hello, ${name}!`);
console.log(`You have finished ${lessons} lessons.`);
Output
Hello, Asha!
You have finished 12 lessons.

And here is JavaScript working with a web page. Click the button:

HTML
<button id="like">Like</button>
<span id="count">0 likes</span>
JavaScript
let likes = 0;
document.getElementById("like").addEventListener("click", () => {
  likes += 1;
  document.getElementById("count").textContent = `${likes} likes`;
});
Result

HTML, CSS and JavaScript#

LanguageJobExample
HTMLContent and structureA button and a counter
CSSPresentationThe button is blue with rounded corners
JavaScriptBehaviourClicking the button increases the counter

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#

PlaceExamples
Web browsersInteractive pages and web apps such as Gmail, Google Maps and online editors
ServersNode.js runs JavaScript on servers: APIs, websites, real-time chat
Front-end frameworksReact, Angular, Vue and Svelte are all JavaScript
Mobile appsReact Native and similar tools build Android and iOS apps
Desktop appsElectron powers apps such as Visual Studio Code
ToolsBuild tools, linters and test runners are mostly written in JavaScript

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#

  1. Fundamentals: variables, types, strings, numbers and operators.
  2. Control flow: conditions and loops.
  3. Functions: parameters, arrow functions, scope, closures and callbacks.
  4. Arrays, objects, Map and Set, JSON and dates.
  5. The DOM and events: making real web pages interactive.
  6. Asynchronous code: the event loop, promises, async/await and fetching data from APIs.
  7. Advanced topics: errors, classes, this, prototypes, modules, generators and regular expressions.
  8. JavaScript on the server with Node.js and npm.

Key takeaway#

Finished this lesson?