Javascript

Repeat an array

This function repeats the elements of an array a given number of times. JavaScript: TypeScript:

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:

Find the index of the last matching item of an array

This function finds the index of the last occurrence of a specified value in an array. JavaScript: TypeScript:

Find the index of the minimum item of an array

This function finds the index of the smallest number in an array. JavaScript: TypeScript:

Find the length of the longest string in an array

This function finds the length of the longest string in an array. JavaScript: TypeScript:

Find the minimum item of an array by given key

This function finds the smallest number in an array of objects, based on a specified key. JavaScript: TypeScript: