The Twin Duel
Easy+15 XP
Mission Briefing
Two warriors enter the arena, but only the strongest can proceed. You must instantly judge who has the higher power level using the shortest spell possible.
The Concept: The Ternary Operator
The ternary operator condition ? exprIfTrue : exprIfFalse is the only JavaScript operator that takes three operands. It's frequently used as a shortcut for the if statement.
The Objective
Your function receives two numbers, a and b.
- Use the ternary operator to determine which number is strictly greater.
- Return the larger number. (Assume they aren't equal for this trial).
Constraints
FundamentalsTernary
JavaScriptSystem handles I/O — write your function only
Loading...
3 Hidden
Input Arguments
a10
b20
Expected Output
20
Click RUN to test your solution