Axel Rauschmayer (2013-05-29T02:50:10.000Z)
It might make sense to add a third argument to that method, so that it works roughly like this:

    Array.prototype.find = function (predicate, returnValue = undefined, thisArg = undefined) {
        var arr = Object(this);
        if (typeof predicate !== 'function') {
            throw new TypeError();
        }
        for(var i=0; i < arr.length; i++) {
            if (i in arr) {  // skip holes
                var elem = arr[i];
                if (predicate.call(thisValue, elem, i, arr)) {
                    return elem;
                }
            }
        }
        return returnValue;
    }

-- 
Dr. Axel Rauschmayer
axel at rauschma.de

home: rauschma.de
twitter: twitter.com/rauschma
blog: 2ality.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20130528/67d6c695/attachment.html>
github at esdiscuss.org (2013-07-12T02:27:21.408Z)
It might make sense to add a third argument to that method, so that it works roughly like this:

```js
Array.prototype.find = function (predicate, returnValue = undefined, thisArg = undefined) {
    var arr = Object(this);
    if (typeof predicate !== 'function') {
        throw new TypeError();
    }
    for(var i=0; i < arr.length; i++) {
        if (i in arr) {  // skip holes
            var elem = arr[i];
            if (predicate.call(thisValue, elem, i, arr)) {
                return elem;
            }
        }
    }
    return returnValue;
}
```