Practice ยท 1 of 2
Countdown and Total
Two loops:
1. Write a function countdown(start) that logs each number from start down to 1 (one per line) using a loop.
2. Write a function sumUpTo(n) that RETURNS the sum of all whole numbers from 1 to n (use an accumulator loop, not a hard-coded answer).
Log sumUpTo(10) โ it should print 55.
Difficulty: intermediate
Press Submit to check your solution.
Back to lesson: Practice: Loops: Repeating Work โ Practice