Javascript

Swap two array items

This function swaps two items in an array based on their indices. JavaScript: TypeScript:

Get the sum of an array of numbers

This function calculates the sum of all the numbers in 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:

Group an array of objects by a key

This function groups an array of objects by a certain key. JavaScript: TypeScript:

Intersperse element between elements

This function intersperses a specific value between the elements of an array. JavaScript: TypeScript:

Partition an array based on a condition

This function partitions an array into two arrays based on a condition. 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:

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: