_.defaultTo(value, defaultValue)
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
.
Since
4.14.0
Arguments
value
(*): The value to check.defaultValue
(*): The default value.
Returns
(*): Returns the resolved value.
Example
_.defaultTo(1, 10);// => 1_.defaultTo(undefined, 10);// => 10
当前内容版权归 lodash.com 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 lodash.com .