

Sum Up To
Write a function sumUpTo(n) that takes an integer n and returns the sum of all numbers from 1 to n (inclusive). If n is less than 1, return 0.
Examples
sumUpTo(5)
→ 15
sumUpTo(0)
→ 0
solution.js
JAVASCRIPT
Saved as you type
Tests
0 of 3 passing- •n=5 → 15sumUpTo(5)expected 15
- •n=0 → 0sumUpTo(0)expected 0
- •n=10 → 55sumUpTo(10)expected 55
On the line
+40 XP
Pass all 3 tests to claim it.
