コンテンツにスキップ

js Listを指定上限の個数に分割#

const splitList = (originalList, maxLength) => {
   let splitedList = []
   for(let i = 0; i < originalList.length; i += maxLength) {
      result.push(originalList.slice(i, i + maxLength));
   }
   - return splitedList
}

References#

Tags#

  • #js