ES5 (ECMAScript 5) introduced strict mode, JSON support, Array methods, and more, making JavaScript more robust and easier to use.
December 2009
ES5 (ECMAScript 5) introduced strict mode, JSON support, Array methods, and more, making JavaScript more robust and easier to use.
Try out JavaScript code examples and experiment with features in the official TypeScript playground.
Open JavaScript PlaygroundEnables 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.Executes a provided function once for each array element.
const arr = [1, 2, 3];
arr.forEach(num => console.log(num)); // 1 2 3Parse JSON strings and convert objects to JSON.
const obj = JSON.parse("{"a":1}");
const str = JSON.stringify(obj); // "{"a":1}"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