Skip to content
Advertisement

Tag: conditional-operator

JavaScript shorthand ternary operator

I know that in PHP 5.3 instead of using this redundant ternary operator syntax: …we can use a shorthand syntax for our ternary operators where applicable: And I know about the ternary operator in JavaScript: …but is there a shorthand? Answer Something like that what you’re looking for, where it defaults if undefined? By the way, this works for a

Advertisement