function foo(arr,num){
return arr.map((item,index,arr) => {
return arr.splice(index,num)
})
}
console.log(foo([1, 2, 3, 4, 5], 2))
//The expected output should be [[1,2],[3,4],[5]]
//In this case output is [[1,2],[4,5]]
For further actions, you may consider blocking this person and/or reporting abuse
Top comments (0)