Back to all blogs

Understanding ECMA Script

April 12th, 2024 - 2 min read

What is the difference between ECMA Script and JavaScript? When we specify the target of ECMA Script version (ES) for the project, what does that mean?


Ecma Script
  • ECMA (European Computer Manufacturers Association) International is an organization that develops and publishes international standards for the information and communication industry.
  • ECMA Script (ECMA 262) is the standard of writing scripting languages, created and maintained by ECMA International.
  • JavaScript is one of the implementations of the ECMA Script standard.
  • Why do we need a standard?
    • By following a standard, all browsers ensure that developers only need to write one codebase that can run across a wide range of browsers.

Reading the ECMA Script standard documentation, some of my important notes:

  • JavaScipt is a general-purpose scripting language. The purpose of a scripting language is to manipulate, customize, and automate the facilities of an existing system (browser, server,...).
  • The existing system provides a host environment (JS Run Time, which contains JS Engine (V8), Web APIs, Event Loop).
  • Host environment is an important term that is used a lot in ECMA Script documentation.
  • Host environment can attach its objects, and functions to the global object. (JS Run Time attach setTimeout to the global object,...).
  • Host environment provides a means to attach scripting code to events such as change of focus, page, and image loading, unloading, error and abort, selection, form submission, and mouse actions (JS code can be executed when the user performs an action in the browser).
  • Host environment can schedule jobs to be executed in JS Engine call stack (Event Loop mechanism takes advantage of this one to perform async tasks).
  • ECMAScript defines all the concepts we need to understand in JS code.
  • Data types:
    • Functions and Classes
    • The global object
    • Host Promise Job Queue (Microtask Queue)
    • ...
  • When a new feature is added to ECMA Script standard:
    • JS Engines (V8 (used in Chrome, NodeJS), SpiderMonkey (used in Firefox), JavaScriptCore (used in Safari),...) implement the new features. But the adoption will take time.
    • If we use the new version of ECMA Script standard, we might need to transpile code into a lower version of ECMA Script (using Babel or SWC), so all modern browsers can be supported.