All academies
All challenges

Sum an Array

easybasics50 XP

Problem

Write a function sumArray that takes an array of numbers and returns their sum. Annotate both the parameter and the return type explicitly. An empty array should return 0.

Expected output

10
10

Hints

Stuck? Reveal hints one at a time.

Solution

Try solving it yourself first — revealing is always available.

Press Run in the editor — your console output is checked automatically.
No errors
Loading...

Console output appears here. Press Run or just type — the code compiles automatically.