always
Create a function that always returns the same value
47 bytes
Usage
Creates a function that always returns the same value, regardless of any arguments passed to it.
Use cases
You can avoid using always
if the value is a primitive (use () => true
instead), but it can be useful if you need a function that always returns the same object reference, or if you want to memoize a calculation across multiple calls.