Skip to content

isNaN

js
_.isNaN(value)

检查 value 是否是 NaN

¥Checks if value is NaN.

注意:此方法基于 Number.isNaN,与全局 isNaN 不同,后者为 undefined 和其他非数字值返回 true

¥Note: This method is based on Number.isNaN and is not the same as global isNaN which returns true for undefined and other non-number values.

新增于

¥Since

0.1.0

参数

¥Arguments

  1. value (*):要检查的值。

    ¥value ()*: The value to check.

返回

¥Returns

(布尔):如果 valueNaN,则返回 true,否则返回 false

¥(boolean): Returns true if value is NaN, else false.

示例

¥Example

js
_.isNaN(NaN);
// => true

_.isNaN(new Number(NaN));
// => true

isNaN(undefined);
// => true

_.isNaN(undefined);
// => false

Lodash v4.17 中文网 - 粤ICP备13048890号