/es5

ECMAScript (JavaScript) 5 compatibility methods

Primary LanguageJavaScriptMIT LicenseMIT

Introduction

‘es5.js’ is a set of ECMAScript (aka JavaScript) 5 compatibility methods, allowing to use some ECMAScript on all web browsers.

The methods are defined only if the native methods are not available. This means that on web browsers that implement these methods, native methods will be used instead, hence providing optimal performance.

Implemented Methods

Currently only the following new methods are implemented:

Object.create( proto ) // does not support second parameter

Function.prototype.bind( thisArg [, arg1[, arg2[, ...]]] )

Array.prototype.indexOf    ( searchElement [, fromIndex ] )
Array.prototype.lastIndexOf( searchElement [, fromIndex ] )
Array.prototype.forEach    ( callback [, thisArg ] )
Array.prototype.every      ( callback [, thisArg ] )
Array.prototype.some       ( callback [, thisArg ] )
Array.prototype.map        ( callback [, thisArg ] )
Array.prototype.filter     ( callback [, thisArg ] )
Array.prototype.reduce     ( callback [, initialValue ] )
Array.prototype.reduceRight( callback [, initialValue ] )

For more information on the above methods, and implementation, check: