Answers for "split array after 4th index javascript"

9

javascript split array into chuncks of

function splitArrayIntoChunksOfLen(arr, len) {
  var chunks = [], i = 0, n = arr.length;
  while (i < n) {
    chunks.push(arr.slice(i, i += len));
  }
  return chunks;
}
var alphabet=['a','b','c','d','e','f'];
var alphabetPairs=splitArrayIntoChunksOfLen(alphabet,2); //split into chunks of two
Posted by: Guest on August-02-2019
1

js split at index

const splitAt = (index: number) => (x: string) => [x.slice(0, index), x.slice(index)]
Posted by: Guest on May-19-2021

Code answers related to "split array after 4th index javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language