Weekly Savings
JavaScript
20 pts
Weekly Savings
Ruta saves money for a new football: 10 Nakfa in week 1, 20 in week 2, 30 in week 3 … (week × 10). Loop over weeks 1 to 8. In every lap add the amount to total and print a line. After the loop, print the total:
Week 1: +10 (total 10) Week 2: +20 (total 30) Week 3: +30 (total 60) Week 4: +40 (total 100) Week 5: +50 (total 150) Week 6: +60 (total 210) Week 7: +70 (total 280) Week 8: +80 (total 360) Total saved: 360
Use at most two console.log() lines and do not type 360.
Checklist
- Add up the savings in
total. - Use a
forloop for weeks 1 to 8. - Print with at most two
console.log()lines. - Print the eight week lines and the total.
🔑 Solution
If you view the solution before passing, you earn half points for this exercise. You still need to type it and press Check to finish.
How it works, step by step
Point at a step to highlight its lines. Type the solution yourself and press Check answer to finish.
