Checks if the given argument is a native boolean element.
Use typeof
to check if a value is classified as a boolean primitive.
代码片段
const isBoolean = val => typeof val === 'boolean';
使用样例
isBoolean(null); // false
isBoolean(false); // true
Checks if the given argument is a native boolean element.
Use typeof
to check if a value is classified as a boolean primitive.
const isBoolean = val => typeof val === 'boolean';
isBoolean(null); // false
isBoolean(false); // true