Home > @infiniteobjects/core-library-web > Functions > constant
Creates a function that returns value
regardless of its input
Signature:
static constant<T = any>(value: T): (..._args: any[]) => T;
Parameter | Type | Description |
---|---|---|
value | T |
Returns:
(…_args: any[]) => T
const fn = Functions.constant(3)
fn(35)
//=> 3
fn()
//=> 3