Files
30-seconds-of-code/snippets/isBoolean.md
2020-09-15 21:52:00 +03:00

18 lines
303 B
Markdown

---
title: isBoolean
tags: type,beginner
---
Checks if the given argument is a native boolean element.
- Use `typeof` to check if a value is classified as a boolean primitive.
```js
const isBoolean = val => typeof val === 'boolean';
```
```js
isBoolean(null); // false
isBoolean(false); // true
```