All Articles

Find the closest number from an array

This function finds the number in an array that is closest to a given target number. JavaScript: TypeScript:

Get indices of a value in an array

This function returns all the indices of a specified value in an array. JavaScript: TypeScript:

Flatten an array

This function flattens an array, meaning it removes one level of nesting. JavaScript: TypeScript:

Find the maximum item of an array

This function finds the largest number in an array. JavaScript: TypeScript:

Get all n-th items of an array

This function returns every n-th item from an array, starting from the first item. JavaScript: TypeScript:

Generate an array of alphabet characters

This function generates an array of alphabet characters from ‘a’ to ‘z’. JavaScript: TypeScript:

Get the average of an array

This function calculates the average of all the numbers in an array. JavaScript: TypeScript:

Get the intersection of arrays

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

Find the maximum item of an array by given key

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

Create an array of cumulative sum

This function generates an array of cumulative sums from the input array. JavaScript: TypeScript: