Convert a NodeList to a JavaScript array
Ever needed to convert a NodeList
to an array in JavaScript? Here's the fastest way to do so.
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.
Ever needed to convert a NodeList
to an array in JavaScript? Here's the fastest way to do so.
Quickly and easily replace or append a value in a JavaScript array.
Sort an array of numbers, using the bucket sort algorithm.
Converts an array of objects to a comma-separated values (CSV) string that contains only the columns
specified.
Sort an array of numbers, using the quicksort algorithm.
Chunk an array or iterable into arrays of a specified size or a given number of chunks.
Map an object to an object array, using the provided mapping function.
Sort an array of numbers, using the selection sort algorithm.
When working with JavaScript arrays, you might need the minimum or maximum value. Here are a few quick and easy ways to do it.
Learn how to merge two arrays of objects, while combining objects based on a specified key.
Learn how to compact an array or object in JavaScript using the Boolean
function and recursion.
Learn how to shuffle, sample and perform weighted selection on JavaScript arrays.
Learn how to split a JavaScript array into two groups based on a function or an array of values.
Learn how to group and count the values of a JavaScript array using simple array methods.
ESLint is a really useful tool, but sometimes it gets in the way. Learn how to refactor code to get rid of a common warning.
Learn the differences between the three most commonly used iteration methods in JavaScript, that often confuse beginners and veterans alike.
Creates an object from an array, using a function to map each value to a key.
Learn how you can compare two arrays in JavaScript using various different techniques.
Efficiently check if a numeric array is sorted in ascending or descending order in JavaScript.
Groups the elements of an array based on the given function.
Learn how to initialize a 2D array in JavaScript in a handful of different ways.
Remove an element from an array if it's included in the array, or push it to the array if it isn't.
Which method do you reach for first? What are the differences between them? Let's find out!
Learn how to create an inclusive array with numbers in a range, using a common step
difference.