JavaScript Interview Question #2

What is the difference between JavaScript and ECMAScript?

JavaScript Fundamentals, Types, Scope & Functions Junior Beginner

Quick Interview Answer

ECMAScript is the standardized language specification on which JavaScript is based. It defines the syntax, types, operators, objects, statements, functions, and other core language behavior.

Detailed Explanation

ECMAScript is the standardized language specification on which JavaScript is based. It defines the syntax, types, operators, objects, statements, functions, and other core language behavior.

JavaScript is an implementation of that specification together with APIs supplied by its runtime environment. For example, the browser provides APIs such as document, window, fetch, and localStorage, while Node.js provides its own server-side APIs. ES6, also called ECMAScript 2015, introduced major features such as let, const, classes, modules, promises, and arrow functions.

Code Example

// let, const and arrow functions are standardized ECMAScript features.
const add = (a, b) => a + b;

console.log(add(2, 3)); // 5