Skip to content


Subversion checkout URL

You can clone with
Download ZIP
JavaScript polyfill functions
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.


Older browsers like Internet Explorer 8 do not implement the
new Array.prototype methods defined in ECMAScript 5. This code
checks if these methods are defined and if not defines them
with implementations as close as possible to
the ECMAScript 5 specifications.

The array polyfills are generic and can iterate over an object
with a length property. They can operation on a string in
an environment where the str[i] syntax works which was an
addition to ECMAScript 5 and is not supported in older browsers.
To reliably iterate over a string use split. For example.""), function(){})

There is a trick in Kris Kowal's es5-shim library to make
the array polyfills more string friendly by splitting the 
string for you. It does, however, send the split string
as the third argument to the iterators which is incorrect.
It is a trade-off and one is not better but this is why
I've chosen not to include the string splitting trick.



Open tst/runner.html in a browser to see the tests run.


Helpful links for implementation comparison:
Something went wrong with that request. Please try again.