Users Pricing

forum

Home Forums Chunk Arrays – MindStick

Chunk Arrays

Steilla Mitchel 2149 12 Jun 2024

Given an array arr and a chunk size size, return a chunked array.

chunked array contains the original elements in arr, but consists of subarrays each of length size. The length of the last subarray may be less than size if arr.length is not evenly divisible by size.

You may assume the array is the output of JSON.parse. In other words, it is valid JSON.

Please solve it without using lodash's _.chunk function.


1 Answers

Markdown for AI

A clean, structured version of this page for AI assistants and LLMs.

Open .md