JavaScript 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.

  • Logarithm in specific base

    Calculates the logarithm of the given number in the given base.

    JavaScript, Math · Oct 22, 2020

  • Negate predicate

    Negates a predicate function.

    JavaScript, Function · Sep 15, 2020

  • Uncached module require

    Loads a module after removing it from the cache (if exists).

    JavaScript, Node · Sep 15, 2020

  • Sum of numbers until n

    Sums all the numbers between 1 and n.

    JavaScript, Math · Oct 22, 2020

  • Unary function arity

    Creates a function that accepts up to one argument, ignoring any additional arguments.

    JavaScript, Function · Oct 22, 2020

  • Value is symbol

    Checks if the given argument is a symbol.

    JavaScript, Type · Sep 15, 2020

  • Approximately number equality

    Checks if two numbers are approximately equal to each other.

    JavaScript, Math · Nov 1, 2020

  • Degrees to radians

    Converts an angle from degrees to radians.

    JavaScript, Math · Sep 15, 2020

  • Number is divisible

    Checks if the first numeric argument is divisible by the second one.

    JavaScript, Math · Sep 15, 2020

  • Number is even

    Checks if the given number is even.

    JavaScript, Math · Oct 20, 2020

  • Number is negative zero

    Checks if the given value is equal to negative zero (-0).

    JavaScript, Math · Oct 20, 2020

  • Value is nil

    Checks if the specified value is null or undefined.

    JavaScript, Type · Oct 20, 2020

  • Value is null

    Checks if the specified value is null.

    JavaScript, Type · Oct 20, 2020

  • Number is odd

    Checks if the given number is odd.

    JavaScript, Math · Oct 20, 2020

  • Number is power of ten

    Checks if the given number is a power of 10.

    JavaScript, Math · Jan 6, 2021