How do you use the ternary operator in JavaScript? #13
Unanswered
ajay-dhangar
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
The ternary operator in JavaScript is a shorthand way of writing an "if/else" statement. It takes three operands: the condition, the value to be returned if the condition is true, and the value to be returned if the condition is false.
Example:
All reactions