Create your own Array Methods | JavaScript ES6 Guide - how to implement Map, Filter, Reduce
You Tube: Simon Høiberg
Learn more...
Article: How To Implement JavaScript Array Methods From Scratch
Article: How to implement every JavaScript array method
Example:
const myCustomMapFunction = function() {
return this.map(e => e * 2)
}
Array.prototype.mul = myCustomMapFunction;
const arr = [1, 2, 3];
console.log(arr.mul()); // [2, 4, 6]