Skip to content

isBoolean

Official

Checks if the given object is a boolean.

Example:

console.log(isBoolean(false)); // true
console.log(isBoolean('not a boolean')); // false

Signature:

function isBoolean(obj: unknown): boolean

Parameters:

ParameterTypeDescription
objunknownThe object to check.

Returns: booleantrue if the object is a boolean, false otherwise.

Example:

console.log(isBoolean(false)); // true
console.log(isBoolean('not a boolean')); // false