Checks value to determine whether a default value should be returned in its place. The defaultValue is returned if value is NaN, null, or undefined.
value
defaultValue
NaN
null
undefined
The value to check.
The default value.
Returns the resolved value.
5.12.0
defaultTo(1, 10)// => 1defaultTo(undefined, 10)// => 10 Copy
defaultTo(1, 10)// => 1defaultTo(undefined, 10)// => 10
Checks
value
to determine whether a default value should be returned in its place. ThedefaultValue
is returned ifvalue
isNaN
,null
, orundefined
.