isBoolean

Returns true when a value can be converted to Boolean

isBoolean(value) → returns boolean

isBoolean Argument Reference

value any
Required

Examples sample code invoking the isBoolean function

Yes is considered a boolean that is true

isBoolean("yes")

Expected Result: YES

No is considered a boolean that is false

isBoolean("no")

Expected Result: YES

Maybe is not considered a boolean

isBoolean("maybe")

Expected Result: NO

true is a boolean

isBoolean(true)

Expected Result: YES

false is a boolean

isBoolean(false)

Expected Result: YES

0 is considered a boolean that is false

isBoolean(0)

Expected Result: YES

23 is considered a boolean that is true

isBoolean(23)

Expected Result: YES


Fork me on GitHub