Javascript
Javascript
Flatten an array
This function flattens an array, meaning it removes one level of nesting. JavaScript: TypeScript:
Javascript
Get all arrays of consecutive elements
This function returns an array of arrays, each of which contains a series of consecutive numbers from the original array.…
Javascript
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:
Javascript
Get indices of a value in an array
This function returns all the indices of a specified value in an array. JavaScript: TypeScript:
Javascript
Find the maximum item of an array
This function finds the largest number in an array. JavaScript: TypeScript:
Javascript
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:
Javascript
Generate an array of alphabet characters
This function generates an array of alphabet characters from ‘a’ to ‘z’. JavaScript: TypeScript:
Javascript
Create cartesian product
This function generates the cartesian product of two arrays. JavaScript: TypeScript:
Javascript
Get the average of an array
This function calculates the average of all the numbers in an array. JavaScript: TypeScript:
Javascript
Count by the properties of an array of objects
This function counts the number of objects in an array that have a specified property value. JavaScript: TypeScript:
Recent comments