Skip to content

Window.isBoolean method

Window › isBoolean

Official

Checks if the given object is a boolean.

Signature:

isBoolean(obj: unknown): obj is boolean

Parameters:

Parameter Type Description
obj unknown The object to check.

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

Example:

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