Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a library which implements new Javascript/Ecmascript 5 methods for older versions?

Although Ecmascript 5 introduces some completely new features, it also adds some new methods (bind, trim, map, etc.) which should be perfectly possible to implement (albeit slower) in current versions. Does a library exist which implements these backwards compatible features (and no more, excluding Prototype et. al.)

like image 951
Justin Love Avatar asked Dec 11 '09 19:12

Justin Love


People also ask

What is the current version of ECMAScript?

11th Edition – ECMAScript 2020.

What version of JavaScript is ES6?

ES6 refers to version 6 of the ECMA Script (Javascript) programming language.

What is the newest version of JavaScript?

ES2015 is the latest version of JavaScript programming language. It is the first major upgrade to JavaScript since 1997.


2 Answers

Kris Kowal and friends have built the es5-shim. It was part of Narwhal, but now lives on its own:

http://github.com/kriskowal/es5-shim/

Was: I've taken to using the global-es5.js shim from narwhal:

http://github.com/280north/narwhal/blob/master/engines/default/lib/global-es5.js

you'll have to take out the require("json"); line at the bottom, but other than that, it should be browser-clean.

like image 105
Sean McMillan Avatar answered Oct 19 '22 04:10

Sean McMillan


Prototype and Underscore implement a lot of those.

like image 33
Justin Johnson Avatar answered Oct 19 '22 05:10

Justin Johnson