检查值是否为 null
严格 === null。与 == null 不同,后者也匹配 undefined。 如需同时匹配 null 和 undefined,使用 isNil。
=== null
== null
undefined
— 待检查的任意值
true 当且仅当 val === null,同时收窄为 null
true
null
isNull(null); // trueisNull(undefined); // falseisNull(0); // false Copy
isNull(null); // trueisNull(undefined); // falseisNull(0); // false
检查值是否为 null
严格
=== null。与== null不同,后者也匹配undefined。 如需同时匹配 null 和 undefined,使用 isNil。