ES5 APIs & Features

ES5 (ECMAScript 5) introduced strict mode, JSON support, Array methods, and more, making JavaScript more robust and easier to use.

Released: December 2009
ECMAScript

Other JavaScript Versions

Release Information

Release Date:

December 2009

Version Type:
Legacy

Quick Summary

ES5 (ECMAScript 5) introduced strict mode, JSON support, Array methods, and more, making JavaScript more robust and easier to use.

Top Features

  • Strict Mode
  • JSON support (JSON.parse, JSON.stringify)
  • Array methods: forEach, map, filter, reduce, some, every
  • Object.create, Object.keys, Object.defineProperty
  • bind method for functions

Playground

Try out JavaScript code examples and experiment with features in the official TypeScript playground.

Open JavaScript Playground

API Examples

Strict Mode

Enables a stricter set of parsing and error handling in your JavaScript code.

"use strict";
var x = 3.14; // Allowed in ES5 strict mode, but some errors are thrown for bad practices.

Array.prototype.forEach

Executes a provided function once for each array element.

const arr = [1, 2, 3];
arr.forEach(num => console.log(num)); // 1 2 3

JSON.parse & JSON.stringify

Parse JSON strings and convert objects to JSON.

const obj = JSON.parse("{"a":1}");
const str = JSON.stringify(obj); // "{"a":1}"

Function.prototype.bind

Creates a new function with a given this value.

function greet() { console.log(this.msg); }
const obj = { msg: "Hello" };
const bound = greet.bind(obj);
bound(); // Hello