CJCoding With Joseph
15free / daySign inCreate account
Back to Code Walkthrough

Chained Ternary Operators

JavaScript code walkthrough · Question 42
mediumIf Statements

Code

Read carefully. What does this print?
1let x = 8;
2let label = x % 2 === 0 ? "even" : "odd";
3let sign = x > 0 ? "pos" : x < 0 ? "neg" : "zero";
4console.log(label + " " + sign);

Your answer