This is my way. First call get an error, second is right
Array.prototype.myEach = function (callback) { // defined my function
for (let index = 0; index < this.length; index++) {
const element = this[index];
callback(element, index)
}
}
['a','b','c'].myEach(console.log) //Cannot read property 'myEach' of undefined
new Array('a','b','c').myEach(console.log) // a b c