Deviopath › JavaScript

Sum Up To N

Easy · Loops

Write a function sumTo that returns the sum of all whole numbers from 1 to n. If n is less than 1, return 0.

Next: FizzBuzz