Mastering Shorthand

Easy+20 XP

Mission Briefing

The arena scoreboard is manually operated, and the scorekeepers are exhausting themselves writing score = score + 10. You must implement a faster shorthand system!

The Concept: Assignment Operators

When we want to update an existing variable, JavaScript provides "Shorthand" assignment operators to make our code cleaner:

  • x += 5 (Add 5 to current x)
  • x -= 2 (Subtract 2 from current x)
  • x++ (Increment exactly by 1)

The Objective

Your function receives a starting score.

  1. Add 10 to the score using the += shorthand.
  2. Increment the result by 1 using the ++ shorthand.
  3. Return the final updated score.

01EXAMPLE 1

Inputscore = 100
Output111

Explanation: 100 + 10 = 110, then 110 + 1 = 111

02EXAMPLE 2

Inputscore = 0
Output11

Explanation: 0 + 10 = 10, then 10 + 1 = 11

Constraints

  • Use shorthand operators to perform the updates.
FundamentalsVariablesUpdates
JavaScript
Loading...
3 Hidden

Input Arguments

score100

Expected Output

111

Click RUN to test your solution