let chunk = (arr, size) => arr.reduce((acc, e, i) => (i % size ? acc[acc.length - 1].push(e) : acc.push([e]), acc), []); let xy = ['2','4','6','7','8','10','20','33','35'] console.log(chunk(xy, xy.length))