Rest assured it’s purely out of curiosity. JavaScript ternary operator is frequently used as a shortcut for the if statement. Return is a keyword we use often to return the final result of a function. I … Questions: Can I write the ‘if else’ shorthand without the else? The ternary operator is a substitute for an if statement in which both the if and else clauses assign different values to the same field, like so: JavaScript If Else JavaScript If Else is used to implement conditional programming. You can argue which technique is shorter, but I enjoy using object literal notation as a clean substitute to functions as constructors. JavaScript provides a conditional operator or ternary operator that can be used as a shorthand of the if else statement. If you chain many if else statements, the code will become hard to read and difficult to maintain. If the condition is satisfied, the statement returns true and an action is performed else if the condition fails, another operation is performed. The if statement executes a statement if a specified condition is truthy. In such situations, you should use the switch statement. JavaScript conditional statements are used to perform various tasks based on different conditions. EDIT: Some of you seem bemused why I’d bother trying this. Our new condition statement is then: "If the subtotal is greater than $200, then apply a 20% discount, else if the subtotal is greater than $100 apply a 10% discount, else if the subtotal is greater than $50 then apply a 5% discount, otherwise no discount is applied." Note that the