Which of the following is used to perform a conditional (ternary) operation in JavaScript?

  • if-else
  • switch
  • ?:
  • for
The ?: operator is known as the ternary operator in JavaScript and is used for conditional operations. It allows you to perform a quick inline conditional check and return one of two values based on the condition. The other options (if-else, switch, for) are not used for conditional operations in the same way.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *