Skip to content

Latest commit

 

History

History
33 lines (21 loc) · 805 Bytes

is-null.md

File metadata and controls

33 lines (21 loc) · 805 Bytes
标题 标签
isNull(是否 null) type(类型)

检查指定的值是否为空或未定义。

  • 使用严格相等运算符检查 val 的值是否等于 null。
const isNull = val => val === null;

ts 代码如下:

调用方式:

isNull(null); // true
isNull(undefined); // true
isNull(''); // false

应用场景

以下是一个实战示例:

结果如下:

<iframe src="codes/javascript/html/is-null.html"></iframe>