数组的fill方法
Array.prototype.MyFill= function (value, start = 0, end) {
end = end || this.length
for (let i = start; i < end; i++) {
this[i] = value
}
return this
}
1
2
3
4
5
6
7
2
3
4
5
6
7
Array.prototype.MyFill= function (value, start = 0, end) {
end = end || this.length
for (let i = start; i < end; i++) {
this[i] = value
}
return this
}