Window.isBoolean method
Window › isBoolean
Official
Checks if the given object is a boolean.Signature:
isBoolean(obj: unknown): obj is booleanParameters:
| Parameter | Type | Description |
|---|---|---|
| obj | unknown | The object to check. |
Returns: obj is boolean — true if the object is a boolean, false otherwise.
Example:
console.log(isBoolean(false)); // trueconsole.log(isBoolean('not a boolean')); // false