Quick TotaL
EasyAcc. 93.5%
+25 XP 8
Incrementing Bills
Writing variable = variable + 5 feels too long for simple everyday changes. So developers commonly rely on += to add onto an existing number neatly. It also manages adding strings perfectly too!
The Assignment
You are updating a customer's payment total.
- Make a variable
totalcarrying theinitialValue. - Add the
amountToAddexactly tototalusing+=. - Use
+=once more to attach " INR" string at the end of the total. - Return this formatted string.
01EXAMPLE 1
Input
initialValue = 100, amountToAdd = 50Output
"150 INR"Explanation: Value added then string correctly appended.
Constraints
- Use the += operator.
- Final result must contain the INR text.
FundamentalsVariablesOperators
JavaScriptSystem handles I/O — write your function only
Loading...
5 Hidden
Input Arguments
initialValue100
amountToAdd50
Expected Output
150 INR
Click RUN to test your solution