I found this code and I dont understand purpose of comment block in parameters:
if (!Array.prototype.some)
{
Array.prototype.some = function(fun /*, thisp*/)
{
var len = this.length;
if (typeof fun != "function")
throw new TypeError();
var thisp = arguments[1];
for (var i = 0; i < len; i++)
{
if (i in this && fun.call(thisp, this[i], i, this))
return true;
}
return false;
};
}
In my opinion it could be normal second parameter and this row could be deleted then:
var thisp = arguments[1];
The implementation of
Array.prototype.somebuilt in to Firefox has an arity of 1, i.e. it accepts one argument. In order to implement the second optional argument without changing the arity the replacement code accesses the second argument viaarguments[1]instead.I don’t actually know what the EcmaScript specification has to say about the arity of
Array.prototype.some.