All Articles

Find the union of two sets

This function finds the union of two sets, i.e., elements that are in either of the two sets. JavaScript:…

Convert a set to an array

This function converts a set to an array. JavaScript: TypeScript:

Get union of arrays

This function returns an array that contains all unique elements of two or more arrays. JavaScript: TypeScript:

Merge two arrays

This function merges two arrays into one. JavaScript: TypeScript:

Remove duplicate values in an array

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

Shuffle an array

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

Repeat an array

This function repeats the elements of an array a given number of times. 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:

Sort an array of items by given key

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

Split an array into chunks

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