The Gilded Entrance

EasyAcc. 96.2%
+20 XP 8

Logic in a Single Line

The Ternary Operator (? :) is a powerful shorthand. It allows you to make a decision and assign a value to a variable all in one line. It follows the pattern: condition ? value_if_true : value_if_false.

The Assignment

Your function receives a boolean parameter named isVip.

  1. Declare a variable named status.
  2. Use a ternary operator to assign "Gold" to status if isVip is true, or "Silver" if false.
  3. Return the exact string: "status : [value]" (where [value] is your status variable).

01EXAMPLE 1

InputisVip = true
Output"status : Gold"

Explanation: isVip is true, so "Gold" is chosen.

02EXAMPLE 2

InputisVip = false
Output"status : Silver"

Explanation: isVip is false, so "Silver" is chosen.

Constraints

  • Use the ternary operator (? :).
  • The return message must match the "status : [value]" pattern exactly.
Control FlowConditionalsOperators
JavaScript
Loading...
4 Hidden

Input Arguments

isViptrue

Expected Output

status : Gold

Click RUN to test your solution