Start of main content## 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.

### Binary function arity

JavaScript, Function

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

### Logical complement

JavaScript, Function

Returns a function that is the logical complement of the given function,

`fn`

.### Logical or for functions

JavaScript, Function

Checks if at least one function returns

`true`

for a given set of arguments.### Negate predicate

JavaScript, Function

Negates a predicate function.

### Time taken by function

JavaScript, Function

Measures the time it takes for a function to execute.

### Unary function arity

JavaScript, Function

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

### Apply function when condition is met

JavaScript, Function

Returns a function that takes one argument and runs a callback if it's truthy or returns it if falsy.