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.

  1. Use the ternary operator to determine which number is strictly greater.
  2. Return the larger number. (Assume they aren't equal for this trial).

Constraints

    FundamentalsTernary
    JavaScript
    Loading...
    3 Hidden

    Input Arguments

    a10
    b20

    Expected Output

    20

    Click RUN to test your solution