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.
Returns the human-readable format of the given number of milliseconds.
JavaScript, Date · Oct 22, 2020
Implements the Luhn Algorithm, used to validate a variety of identification numbers.
JavaScript, Math · Jan 30, 2022
When working with numeric arrays in JavaScript, you might need to find the minimum or maximum value. Here's a quick and easy way to do it.
JavaScript, Array · Nov 6, 2021
Returns the ISO format of the given number of seconds.
JavaScript, Date · Oct 13, 2021
Generates primes up to a given number, using the Sieve of Eratosthenes.
JavaScript, Math · Dec 28, 2020
Converts a number to an array of digits, removing its sign if necessary.
JavaScript, Math · Oct 18, 2020
Calculates the distance between two points in any number of dimensions.
JavaScript, Math · Dec 28, 2020
Converts a color code to an rgb()
or rgba()
string if alpha value is provided.
JavaScript, String · Oct 19, 2020
Finds a contiguous subarray with the largest sum within an array of numbers.
JavaScript, Algorithm · Sep 7, 2022
Calculates the sum of the powers of all the numbers from start
to end
(both inclusive).
JavaScript, Math · Oct 22, 2020
Creates an array of numbers in the arithmetic progression, starting with the given positive integer and up to the specified limit.
JavaScript, Math · Oct 13, 2021
Calculates the ranking of an array based on a comparator function.
JavaScript, Array · Apr 13, 2022
Calculates the greatest common divisor between two or more numbers/arrays.
JavaScript, Math · Dec 29, 2020