Carrot reference
Functions
boolean()
Converts supported datatypes into a Boolean, equal to either true or false.
boolean(value)
- value - the value to be evaluated by the function.
boolean(0) returns false.
boolean("yes") returns true.
Input type | Return type | Logic |
---|---|---|
String | Boolean | String values that start with y or t return true. String values that start with n or f return false. |
Number | Boolean | Number values equal to 0 return false. Non-zero Number values return true. |
Boolean | Boolean | Boolean values remain unchanged. |
Unsupported type | Null | Unsupported data types return Null. |