fork(4) download
  1. function chunkArray(array, size) {
  2. let result3 = [];
  3. for (let i = 0; i < array.length; i += size) {
  4. let chunk = array.slice(i, i + size);
  5. result3.push(chunk);
  6. }
  7. return result3;
  8. }
  9. console.log(chunkArray([1, 2, 3, 4, 5, 6, 7, 8], 3));
Success #stdin #stdout #stderr 0.01s 5268KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
Error: near line 1: near "function": syntax error
Error: near line 3: near "for": syntax error
Error: near line 5: near "result3": syntax error
Error: near line 6: unrecognized token: "}"
Error: near line 8: unrecognized token: "}"