FSM Full Stack Masterclass
Platform under construction
JavaScript course badge

JavaScript Basics

Basic

ECMAScript

ECMAScript is the official language standard behind JavaScript; it defines the core language, while browsers and runtimes add their own APIs around it.

const scores = [12, 18, 24];
const total = scores.reduce((sum, score) => sum + score, 0);

console.log(total); // 54

JavaScript Basics

JavaScript is the language you write. ECMAScript is the standard that defines it.

People often use JavaScript and ECMAScript as if they mean the same thing. They are connected, but not identical. ECMAScript describes the core language: syntax, values, functions, objects, modules and many built-in features.

JavaScript is the practical language experience in a real environment. In a browser that includes the DOM, events, fetch, storage and many web APIs. In Node.js that includes file system APIs, server APIs and packages from npm.

This matters because not every feature belongs to the same layer. Optional chaining is language syntax. document.querySelector is a browser DOM API. fs.readFile is a Node.js API.

ECMAScript

The language specification maintained through the TC39 standards process.

JavaScript

The everyday name for implementations of ECMAScript plus host APIs.

Host environment

The place where code runs: browser, Node.js, Deno, Bun or another runtime.

Feature support

New language features must be supported by the runtime or transformed by tooling.

Examples

Good JavaScript is clear, scoped and easy to debug.

Separate language features from browser APIs

// ECMAScript language feature
const user = { name: "User A", progress: { modules: 4 } };
const modules = user.progress?.modules ?? 0;

// Browser API
document.querySelector("[data-items]").textContent = String(modules);

Everything called JavaScript without context

// This mixes language, browser APIs and server APIs without thinking.
const title = document.querySelector("h1");
const file = fs.readFileSync("data.json");
const value = object?.deep?.property;

Rules that matter

Learn the decision before memorizing the keyword.

JavaScript becomes much easier when you understand why a pattern exists. The syntax is only the surface; the real skill is choosing the right behavior for the interface.

Know the layer

Ask whether a feature is part of the language, the browser, Node.js or a library.

Check runtime support

Modern syntax is powerful, but older browsers or servers may not support it.

Use standards as direction

ECMAScript evolves through proposals. Stable features are safer than experimental ones.

Do not confuse APIs

The DOM is not ECMAScript. It is a browser API JavaScript can use.

Prefer modern basics

const, let, arrow functions, template literals and modules are normal modern JavaScript.

Document requirements

If a project needs a minimum browser or Node version, write that down.

Production thinking

JavaScript quality is visible in behavior, reliability and trust.

Why does this matter?

Understanding ECMAScript prevents confusion. You stop asking why a browser feature does not work in Node, or why a new syntax feature fails in an old runtime.

Accessibility

Accessibility APIs are usually browser and HTML concerns. JavaScript can support them, but ECMAScript itself does not make an interface accessible.

Production note

Production projects should define supported runtimes. That determines whether you need transpiling, polyfills or runtime upgrades.

SEO note

Search engines do not care about the name ECMAScript, but they do care when unsupported JavaScript breaks navigation, content or rendering.

Live code lab

Change the HTML, CSS or JavaScript and run the result.

The preview runs inside an isolated iframe. The JavaScript is placed inside the HTML editor for now, so every example stays together and remains easy to understand.

Mini assignment

Try this now.

  • Change the level value and run the code again.
  • Remove meta from the object and see why optional chaining prevents a crash.
  • Change the selector and notice what happens if the browser cannot find the element.

Practice assignment

Do this before moving to the next topic.

  1. Write down three ECMAScript features you already recognize.
  2. Write down three browser APIs JavaScript can use.
  3. Explain the difference between language and runtime in one sentence.

Try it yourself

Use modern language syntax with browser output

Live preview

Self-check

Before you continue, prove that you understand ECMAScript.

Basic

Do not only read the topic. Change the code, explain what happened and answer the questions in your own words.

  1. Can you explain what ECMAScript defines?
  2. Can you name one browser API that is not ECMAScript?
  3. Can you explain why runtime support matters?
  4. Can you tell the difference between syntax and an API?
  5. Can you explain why standards make JavaScript more predictable?

Senior audit upgrade

Extra production context for ECMAScript.