SOURCE

Array.prototype.forEach = function (callback) {
  let len = this.length
  for (let i = 0; i < len; i++) {
    callback(this[i], i, this)
  }
}

var a = [1, 2, 3]

a.forEach((item, index, context) => {
  a[index + 1] ='a_' + index
  console.log(item, context)
})
console 命令行工具 X clear

                    
>
console