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, Array
Counts the occurrences of a value in an array.
JavaScript, Array
Returns every nth
element in an array.
JavaScript, Array
Creates a frozen Set
object.
JavaScript, Array
Initializes a 2D array of given width and height and value.
JavaScript, Array
Returns the elements that exist in both arrays, filtering duplicate values.
JavaScript, Array
Returns the nth element of an array.
JavaScript, Array
Finds the lowest index at which a value should be inserted into an array in order to maintain its sorting order.
JavaScript, Array
Transposes a two-dimensional array.
JavaScript, Array
Filters out the elements of an array that have one of the specified values.
JavaScript, Array
You can use a lot of different techniques to empty an array in JavaScript. See which ones best suits your needs with this quick guide.
JavaScript, Function
Changes a function that accepts an array into a variadic function.
JavaScript, Array
Gets the first n
elements of an array.
JavaScript, Array
Gets the last n
elements of an array.
JavaScript, Math
Calculates the median of an array of numbers.
JavaScript, Array
Finds the highest index at which a value should be inserted into an array in order to maintain its sort order.