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.
JavaScript, Date
Returns the human-readable format of the given number of milliseconds.
JavaScript, Array
When working with numeric arrays in JavaScript, you might find yourself in need of finding the minimum or maximum value. Here's a quick and easy way to do it.
JavaScript, Math
Implements the Luhn Algorithm, used to validate a variety of identification numbers.
JavaScript, Date
Returns the ISO format of the given number of seconds.
JavaScript, Math
Generates primes up to a given number, using the Sieve of Eratosthenes.
JavaScript, Math
When formatting decimal values in JavaScript, trailing zeros can be undesired. Here's how to deal with them.
JavaScript, Math
Creates an array of numbers in the arithmetic progression, starting with the given positive integer and up to the specified limit.
JavaScript, Math
Converts a number to an array of digits, removing its sign if necessary.
JavaScript, Math
Calculates the distance between two points in any number of dimensions.
JavaScript, String
Converts a color code to an rgb()
or rgba()
string if alpha value is provided.
JavaScript, Math
Returns the powerset of a given array of numbers.
JavaScript, Math
Calculates the sum of the powers of all the numbers from start
to end
(both inclusive).
JavaScript, Math
Calculates the average of an array, after mapping each element to a value using the provided function.
JavaScript, Math
Calculates the cartesian product of two arrays.
JavaScript, Math
Calculates the greatest common divisor between two or more numbers/arrays.