Namespace: Util:if

Util:if

Source:

Methods

if(condition, then, else) → {*}

Build a ternary expression.

Parameters:
Name Type Description
condition boolean

the condition to evaluate

then *

the return value if "condition" is truthy

else *

the return value if "condition" is falsy

Source:
Returns:
"then", if "condition" is truthy otherwise "else"
Type
*
Example
if(1 == 2, 'math genius', 'idiot')
// => 'idiot'