Array.prototype._forEach = function(fn){ console.log(this) for(var i=0; i<this.length; i++){ fn(this[i], i, this); } } var arr = [1,2,3,4,5,6] arr._forEach(item => { console.log(item) })