The Color Palette

Easy+15 XP

Mission Briefing

The Grand Alchemist's automated sorter needs to categorize exotic ingredients by their resulting potion color.

The Concept: Clean Branching

A switch statement is perfect for string matching. It evaluates an expression and executes code corresponding to a matching case label.

The Objective

Your function receives a string fruit. Use a switch statement to return its corresponding color:

  • "Apple": return "Red"
  • "Banana": return "Yellow"
  • Default: return "Clear"

Constraints

    FundamentalsSwitch
    JavaScript
    Loading...
    3 Hidden

    Input Arguments

    fruit"Banana"

    Expected Output

    Yellow

    Click RUN to test your solution