Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

The method to create a conditional statement before a property or after a dot (.) is to use the dot notation and the conditional operator (?:). For example:

// Before property if (condition) { object.property = value1; } else { object.property = value2; }

// After dot object.property = condition ? value1 : value2;