Chapter 315mChallenge

JavaScript Functions — Challenge

Reusable blocks of code.

Sum of Array

medium

Sum of Array

Given const nums = [1, 2, 3, 4, 5], print the sum of all numbers using .reduce().

Expected Output

text
15
Test cases (1)
1 · outputs 15
expected: 15
javascript
Loading editor...