A polyfill supplies a browser feature that is missing, letting code use the standard API where native support is absent. Check for native support first and leave it untouched when available. section 14.3.2 section 14.3
Listing 14.2. A polyfill for the Array.prototype.find method
if (!Array.prototype.find) { #A
Array.prototype.find = function(predicate) { #B
if (this === null) {
throw new TypeError('find called on null or undefined');
}
if (typeof predicate !== 'function') {
throw new TypeError('predicate must be a function');
}
var list = Object(this);
var length = list.length >>> 0; #C
var thisArg = arguments[1];
var value;
for (var i = 0; i < length; i++) { #D
value = list[i]; #D
if (predicate.call(thisArg, value, i, list)) { #D
return value; #D
} #D
} #D
return undefined;
};
}
This Array.prototype.find polyfill checks for native support, then loops through the array and returns the first value accepted by the predicate. section 14.3.2

