The JavaScript snippet collection contains a wide variety of ES6 helper functions. It includes helpers for dealing with primitives, arrays and objects, as well as algorithms, DOM manipulation functions and Node.js utilities.
Calculates the average of an array, after mapping each element to a value using the provided function.
JavaScript, Math · Oct 21, 2020
Calculates the sum of an array, after mapping each element to a value using the provided function.
JavaScript, Math · Nov 3, 2020
Initializes an array containing the numbers in the specified geometric progression range.
JavaScript, Math · Dec 28, 2020
Converts an integer to its roman numeral representation. Accepts value between 1
and 3999
(both inclusive).
JavaScript, Math · Oct 22, 2020
Returns the n
maximum elements from the provided array.
JavaScript, Math · Oct 21, 2020
Returns the n
minimum elements from the provided array.
JavaScript, Math · Oct 21, 2020
Converts a number in bytes to a human-readable string.
JavaScript, String · Oct 22, 2020
When formatting decimal values in JavaScript, trailing zeros can be undesired. Here's how to deal with them.
JavaScript, Math · May 8, 2022
Creates a new array out of the two supplied by creating each possible pair from the arrays.
JavaScript, Math · Oct 22, 2020
Returns the maximum value of an array, after mapping each element to a value using the provided function.
JavaScript, Math · Oct 21, 2020
Returns the minimum value of an array, after mapping each element to a value using the provided function.
JavaScript, Math · Oct 21, 2020
Finds the lowest insertion index to maintain array sorting order based on the provided iterator function.
JavaScript, Array · Oct 22, 2020
Generates an array, containing the Fibonacci sequence, up until the nth term.
JavaScript, Math · Dec 28, 2020