This page allows you to test various implementations of Array.prototype.push
and Array.prototype.pop
. The implementations were selected from high-ranking Google results for push and pop.
The tests expose the fact that (at the time of writing) no browser implements arrays 100% correctly. If your browser passes all the tests, please let me know by commenting on my push and pop blog entry.
Origin | Test | Summary |
---|---|---|
Browser | Test the native implementation built-in to your browser | |
Ash Searle | Fully compliant implementation (only fails tests that depend on perfect array implementation.)
view source…
|
|
Unknown | Common/trivial implementation seen on sites such as WebMonkey, JavaScript Method Library, LunaMetrics and many others...
view source…
|
|
FAQTs |
Example push/pop implementations at FAQTs (original source: WebReference). Note: pop polutes global-scope with lastElement (easily fixed with an appropriate var )
view source…
|
|
Douglas Crockford | Doug Crockford's implementation depends on a reusable splice and slice Array methods. This can hang on sparse-arrays (i.e. the test may hang on Internet Explorer)
view source…
|