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.

  • Run promises in series

    Runs an array of promises in series.

    JavaScript, Function · Oct 22, 2020

  • Throttle function

    Creates a throttled function that only invokes the provided function at most once per every wait milliseconds

    JavaScript, Function · Oct 13, 2021

  • Uncurry function

    Uncurries a function up to depth n.

    JavaScript, Function · Oct 22, 2020

  • What is a pure function?

    Pure functions are a very important concept to know, especially if you're interested in functional programming.

    JavaScript, Function · Dec 19, 2021

  • What is the difference between synchronous and asynchronous code in JavaScript?

    Understanding the differences between synchronous and asynchronous code is a crucial piece of knowledge for every web developer.

    JavaScript, Function · Nov 14, 2021

  • Bind all object methods

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

    JavaScript, Object · Nov 3, 2020

  • Call function once

    Ensures a function is called only once.

    JavaScript, Function · Oct 21, 2020

  • Transform function arguments

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

    JavaScript, Function · Oct 21, 2020

  • Pipe functions

    Performs left-to-right function composition.

    JavaScript, Function · Oct 22, 2020

  • Convert function from variadic

    Takes a variadic function and returns a function that accepts an array of arguments.

    JavaScript, Function · Jun 13, 2021

  • Unfold array

    Builds an array, using an iterator function and an initial seed value.

    JavaScript, Function · Sep 15, 2020

  • What is the difference between then and finally in a JavaScript promise?

    On the surface, a JavaScript promise's then and finally methods seem very similar. But there are a few important differences you need to keep in mind.

    JavaScript, Function · Jun 12, 2021

  • Chain async functions

    Chains asynchronous functions.

    JavaScript, Function · Sep 15, 2020

  • Chunk iterable

    Chunks an iterable into smaller arrays of a specified size.

    JavaScript, Function · Mar 16, 2021

  • Memoize function

    Returns the memoized (cached) function.

    JavaScript, Function · Oct 21, 2020