Javascript Shorthand If Else
Using Shorthand Conditional Expressions
Longhand:
if (check == 'OK'){var name = 'Mike';}
else{var name = 'Joe';}
Shorthand:
var name = (check=='OK') ? 'Mike':'Joe';Longhand:
if (check == 'OK'){var name = 'Mike';}
else{var name = 'Joe';}
Shorthand:
var name = (check=='OK') ? 'Mike':'Joe';