petermichaux/polyfill — Issue #1: ease back from spec
Author: jdalton
Created: 2012-01-28 22:24:20+00:00
State: open

Your ES5 fallbacks look good but I think you are sometimes following the spec a bit too close and missing some common sense tweaks.

For example you don't have to exit early in your `Array#indexOf` and `Array#lastIndexOf` methods as [the condition in their while loops](https://github.com/petermichaux/polyfill/blob/ded3c85541e287056ba712d8b858bd6c35bdfe1c/src/array.js#L95) will take care of that.

Also [this snippet](https://github.com/petermichaux/polyfill/blob/ded3c85541e287056ba712d8b858bd6c35bdfe1c/src/array.js#L137-140) could simply be:

~~~ js
// step 7
else {
k = len + n;
}
~~~

Something else to consider is that while using the `arguments` object helps you follow spec for each method's `.length` property it can cost you [~10%` or more on performance](http://jsperf.com/arguments-vs-polyfill#chart=bar). As most devs aren't aware of the function `.length` property, much less check for its compliance, I think you could opt out of complying with spec on it for better perf.