这样为什么会通过,我觉得最后一次是不应该执行,但它确实加入到新数组里了。。。。。。
Black-Dong opened this issue · comments
Challenge Chunky Monkey has an issue.
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.68 Safari/537.36
.
Please describe how to reproduce this issue, and include links to screenshots if possible.
My code:
function chunk(arr, size) {
// 请把你的代码写在这里
var arrT = [];
for(var i = 0; i < arr.length;i += size){
arrT.push(arr.slice(i, i+size));
}
return arrT;
}
chunk([0, 1, 2, 3, 4, 5], 4);
我混乱了。。。。。。因为i是start,最后一次i还没超出范围