IsBoolean

Determine whether a given object is a boolean

Method Signature

IsBoolean(object=[any])

Arguments

Argument
Type
Required
Description
Default

object

any

true

The value to test for boolean-ness.

Examples

Yes

Yes is considered a boolean that is true

Run Example

isBoolean( "yes" );

Result: true

No

No is considered a boolean that is false

Run Example

Result: true

Maybe

Maybe is not considered a boolean

Run Example

Result: false

True

true is a boolean

Run Example

Result: true

False

false is a boolean

Run Example

Result: true

Zero

0 is considered a boolean that is false

Run Example

Result: true

Non Zero Integer

23 is considered a boolean that is true

Run Example

Result: true

Additional Examples

Run Example

Run Example

Last updated

Was this helpful?