Files
30-seconds-of-code/snippets/isBoolean.md
Angelos Chalaris 97c250bcfb Updated examples
2017-12-27 16:35:25 +02:00

15 lines
268 B
Markdown

### isBoolean
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
```