Find the most frequent element in a JavaScript array
Find the most frequently occurring element in a JavaScript array of primitives or objects.
The JavaScript article 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.
Find the most frequently occurring element in a JavaScript array of primitives or objects.
Learn how to build an undirected tree from an array of edges in JavaScript, with various approaches for storing node relationships.
Have you tried solving "Best Time to Buy and Sell Stock" on LeetCode? Let's take a couple of approaches to tackle it in JavaScript.
Generate all permutations of an array's elements or a string's characters using recursion.
Ever wanted to initialize an array with a sequence of generated values? Here's a few ways to do it.
Learn the differences between the three most commonly used iteration methods in JavaScript, that often confuse beginners and veterans alike.
JavaScript arrays have a very robust API offering some amazing tools. Learn the 4 must-know JavaScript array methods in this quick guide.
Learn how to traverse an undirected tree using Depth-First Search (DFS) or Breadth-First Search (BFS) in JavaScript.
Ever wanted to use negative indices in JavaScript arrays? Here's a simple way to do it using a Proxy.
Did you know you can get the index of an array item in a JavaScript for...of loop? Learn how with this bite-sized tip.
Chunk an array or iterable into arrays of a specified size or a given number of chunks.
Quickly and easily replace or append a value in a JavaScript array.
Ever needed to convert a NodeList to an array in JavaScript? Here's the fastest way to do so.
Sort an array of numbers, using the heapsort algorithm.
Calculate the ranking of an array based on a comparator function in JavaScript.
Sort an array of numbers, using the selection sort algorithm.
Sort an array of numbers, using the quicksort algorithm.
Did you know you can define an iterator for any JavaScript value? This quick tip will show you how.
Sort an array of numbers, using the bucket sort algorithm.
Learn how to shuffle, sample and perform weighted selection on JavaScript arrays.
Learn how to apply bipartite coloring to an undirected tree in JavaScript, ensuring that no two adjacent nodes share the same color.
When working with JavaScript arrays, you might need the minimum or maximum value. Here are a few quick and easy ways to do it.
Remove an element from an array if it's included in the array, or push it to the array if it isn't.
Map an object to an object array, using the provided mapping function.