isBoolean

Returns true when a value can be converted to Boolean

isBoolean(value) → returns boolean

Argument Reference for the isBoolean function

value

Required: Yes

Examples sample code invoking the isBoolean function


Yes

Yes is considered a boolean

isBoolean("yes")

Expected Result: YES


No

No is considered a boolean

isBoolean("no")

Expected Result: YES


Maybe

Maybe is not considered a boolean

isBoolean("maybe")

Expected Result: NO


True

true is a boolean

isBoolean(true)

Expected Result: YES


False

false is a boolean

isBoolean(false)

Expected Result: YES


Zero

0 is considered a boolean that is false

isBoolean(0)

Expected Result: YES


Non Zero Integer

23 is considered a boolean that is true

isBoolean(23)

Expected Result: YES


Fork me on GitHub