Using ternary operators in place of If and Else in WebStorm Editor