To check
boolean
in JavaScript, do this: typeof value === 'boolean'
.Here's how you do it:
const aNumber = 2;
const aString = 'Hello World!';
const aBoolean = true;
console.log(typeof aNumber === 'boolean'); // false
console.log(typeof aString === 'boolean'); // false
console.log(typeof aBoolean === 'boolean'); // true