Javascript
Javascript
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:
Javascript
Get all subsets of an array
This function generates all possible subsets of an array. JavaScript: TypeScript:
Javascript
Sort an array of numbers
This function sorts an array of numbers in ascending order. JavaScript: TypeScript:
Javascript
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…
Javascript
Zip multiple arrays
This function ‘zips’ multiple arrays, merging them into one array of tuples, where the first element of each input array…
Javascript
Get the unique values of an array
This function removes all duplicate values from an array. JavaScript: TypeScript:
Javascript
Swap two array items
This function swaps two items in an array based on their indices. JavaScript: TypeScript:
Javascript
Get the sum of an array of numbers
This function calculates the sum of all the numbers in an array. JavaScript: TypeScript:
Javascript
Get union of arrays
This function returns an array that contains all unique elements of two or more arrays. JavaScript: TypeScript:
Javascript
Group an array of objects by a key
This function groups an array of objects by a certain key. JavaScript: TypeScript: