JavaScript Function Snippets

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 arrow functions are a very useful tool to learn and master. Here's a complete introduction to everything you need to know.

  • JavaScript callbacks are especially tricky when you're not careful. Take a deeper dive into potential issues and how to avoid them.

  • rearg

    JavaScript, Function

    Creates a function that invokes the provided function with its arguments arranged according to the specified indexes.

  • JavaScript's built-in Boolean function can be very useful for truth-checking data among other things. Learn how to use it and level up your code today.

  • cycleGenerator

    JavaScript, Function

    Creates a generator, looping over the given array indefinitely.

  • debouncePromise

    JavaScript, Function

    Creates a debounced function that returns a promise, but delays invoking the provided function until at least ms milliseconds have elapsed since the last time it was invoked. All promises returned during this time will return the same data.

  • functions

    JavaScript, Object

    Gets an array of function property names from own (and optionally inherited) enumerable properties of an object.

  • runPromisesInSeries

    JavaScript, Function

    Runs an array of promises in series.

  • Learn and understand closures, a core concept in JavaScript programming, and level up your code.

  • JavaScript ES6 introduced us to several powerful features, such as the spread and rest syntax. Learn everything you need to know in this quick guide.

  • bindAll

    JavaScript, Object

    Binds methods of an object to the object itself, overwriting the existing method.

  • mostPerformant

    JavaScript, Function

    Returns the index of the function in an array of functions which executed the fastest.

  • once

    JavaScript, Function

    Ensures a function is called only once.

  • overArgs

    JavaScript, Function

    Creates a function that invokes the provided function with its arguments transformed.

  • pipeFunctions

    JavaScript, Function

    Performs left-to-right function composition.