How can I implement a singleton in JavaScript?
Learn how to implement the singleton design pattern in JavaScript, using the Proxy object.
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.
Learn how to implement the singleton design pattern in JavaScript, using the Proxy object.
Generate a UUID in JavaScript using native APIs in both the browser and Node.js.
Generate all permutations of an array's elements or a string's characters using recursion.
Creates a pub/sub event hub with emit, on, and off methods.
Ever wanted to initialize an array with a sequence of generated values? Here's a few ways to do it.
Renders the given DOM tree in the specified DOM element.
JavaScript arrays have a very robust API offering some amazing tools. Learn the 4 must-know JavaScript array methods in this quick guide.
JavaScript's arrow functions are seemingly the same as regular functions, but there are some important differences you need to know.
Currying is a process that transforms a function that takes multiple arguments into a series of functions that each take a single argument.
A binary search tree is a hierarchical data structure of ordered nodes with at most two children each.
A custom data structure to keep track of value frequencies in an array.
Sort an array of numbers, using the heapsort algorithm.
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.
Maps and objects are very similar, but they have some differences that can help you decide which one better fits your use-case.
Learn how to add or remove event listeners from elements with ease.
Calculate the ranking of an array based on a comparator function in JavaScript.
The Caesar cipher is a simple substitution cipher, which can be easily implemented with a few lines of JavaScript code.
JavaScript uses callback functions quite a lot. From event listeners to asynchronous code, they're an invaluable tool you need to master.
Closures are used frequently, yet often misunderstood. Understanding them in depth is crucial to be able to write clean, maintainable code.
Function arity is a simple, yet useful concept in functional programming, especially when combined with currying.
Implement the Luhn Algorithm, used to validate a variety of identification numbers.
Did you know you can define an iterator for any JavaScript value? This quick tip will show you how.
Ever needed to convert a NodeList
to an array in JavaScript? Here's the fastest way to do so.
Learn how you can compare two objects in JavaScript using various different techniques.