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 product of two or more numbers/arrays.
JavaScript, Math · Oct 22, 2020
Finds the lowest index at which a value should be inserted into an array in order to maintain its sorting order.
JavaScript, Array · Oct 22, 2020
Formats a number using fixed-point notation, if it has decimals.
JavaScript, Math · May 10, 2022
Generates a random integer in the specified range.
JavaScript, Math · Oct 22, 2020
Generates a random number in the specified range.
JavaScript, Math · Oct 22, 2020
Takes a number and returns it in the specified currency formatting.
JavaScript, Math · Oct 22, 2020
Takes a number and returns it as a string with the correct ordinal indicator suffix.
JavaScript, Math · Nov 13, 2020
Numeric separators are a somewhat lesser-known JavaScript syntactic sugar that can make working with large constants a lot easier.
JavaScript, Math · Jun 27, 2021
Calculates the number of ways to choose k
items from n
items without repetition and without order.
JavaScript, Math · Dec 28, 2020
Ever needed to convert a decimal number to hexadecimal? Here's a quick and easy way to do it.
JavaScript, Math · Sep 21, 2022