#array Clear
Tags #utils #browser #performance #array #async #dom #objects #pattern #events #format #concurrency #http #ui #advanced #fetch #url #string #functional #cache #files #crypto #promise #intl #observer
JavaScript Group Array by Key
Groups an array of objects into a map keyed by the result of a callback or property name. Uses Object.groupBy when available (ES2024) and falls back to a reduce implementation. Returns an object whose keys are the group names and values are arrays of matching items.
JavaScript Flatten Nested Array
Recursively flattens an array of arbitrary nesting depth into a single flat array. Accepts an optional depth limit — pass Infinity to flatten completely. Uses the native Array.flat when the browser supports it, otherwise falls back to a recursive reduce.
JavaScript Chunk Array
Splits an array into smaller arrays (chunks) of a specified size. The last chunk may be smaller if the array length is not evenly divisible. Useful for batch processing, pagination, rendering large lists in chunks, and rate-limited API calls.
JavaScript Unique Array Values
Returns a new array with duplicate values removed. The fast version uses a Set for primitives. The deep version supports deduplicating objects by a specific key, making it suitable for deduplicating API results or merged data sets.
JavaScript Shuffle Array (Fisher-Yates)
Randomly shuffles an array in-place using the Fisher-Yates algorithm, which produces a uniformly random permutation. Widely considered the correct way to shuffle — avoids the bias inherent in sort(() => Math.random() - 0.5). Returns the same array reference after shuffling.
JavaScript Range Generator
Generates an array of numbers from start to end (inclusive) with an optional step. Supports negative steps for counting down. Covers the most common use case of Array.from({ length: n }, (_, i) => i) with a much cleaner API, and handles arbitrary start/end/step combinations.