...

Exercise: Basic Calculator

Time to build a calculator! This exercise introduces a new concept: comparing strings using ===.

The === operator checks if two values are exactly the same. For strings, this means every character must match perfectly, including capitalization.

Complete and run the code sample to see the equality comparison in action.

Your Task

  1. Declare the variable result
  2. Complete each if-else branch to perform the correct calculation
  3. Handle invalid operations by setting result to "Invalid"
  4. Using an if-else statement, print the appropriate message based on the result

Expected outputs:

  • 10, 5, "+": "The result is: 15"
  • 10, 5, "%": "Invalid operation"
Loading...

Output (Console)