K
Q. A conditional expression is also called a
- Correct Answer - Option(C)
- Views: 162
- Filed under category JavaScript
K
A conditional expression in JavaScript refers to the ternary operator (? :), which is also known as the "immediate if" because it provides a quick, one-line alternative to an if-else statement.
Syntax of Ternary Operator:
condition ? expression1 : expression2;
Example:
let age = 18;
let canVote = (age >= 18) ? "Yes" : "No";
console.log(canVote); // Output: "Yes"
Why Not Other Options?
You must be Logged in to update hint/solution
Be the first to start discuss.
Discusssion
Login to discuss.