Javascript

Shuffle an array

This function shuffles the elements of an array. JavaScript: TypeScript:

Remove falsy values from array

This function removes all ‘falsy’ values (false, null, 0, ”, undefined, and NaN) from an array. JavaScript: TypeScript:

Split an array into chunks

This function splits an array into chunks of a specified size. JavaScript: TypeScript:

Sort an array of items by given key

This function sorts an array of objects based on a given key. JavaScript: TypeScript:

Swap the rows and columns of a matrix

This function swaps the rows and columns of a 2D array, also known as ‘transposing’ a matrix. JavaScript: TypeScript:

Get all subsets of an array

This function generates all possible subsets of an array. JavaScript: TypeScript:

Sort an array of numbers

This function sorts an array of numbers in ascending order. JavaScript: TypeScript:

Get the rank of an array of numbers

This function returns an array with the same length as the input array, where each element is the rank of…

Zip multiple arrays

This function ‘zips’ multiple arrays, merging them into one array of tuples, where the first element of each input array…

Get the unique values of an array

This function removes all duplicate values from an array. JavaScript: TypeScript: