1 个回答
Array.prototype.map = (el, index, arr) => {
    ...
}

可以用arr[index] = 1这样的方式来改变原数组,但是语义上不推荐这么做,建议用foreach代替

推荐问题