Array.prototype.find ES6 polyfill for ES5 versions and lower.
Array.prototype.find ES6 polyfill for ES5 versions and lower via NPM, you only need to require the module in order to have it working in order to use knowing that is going to work in browsers that does not support this function natively.
- Based from Mozilla polyfill.
- Require the
npm install --save-dev jspolyfill-array.prototype.find
- Include the file before the usage.
Then you need to require the file on your
main.js or where you are
going to plan to use the
find function as follows:
arr is your array.
callbackFunction to execute on each value in the array, taking three arguments:
elementThe current element being processed in the array.
indexThe index of the current element being processed in the array.
arrayThe array find was called upon.
thisArgOptional. Object to use as
thiswhen executing callback.
The callback passed as a parameter inside of the
find function is
fired every time per each element inside of the array until finds an
element where the callback evaluates to
It returns the first match if no match is found it will return
For more information click here.