dde272c4b8
i18n - Build Validation / Validate i18n Builds (24) (push) Has been cancelled
CI - Node.js / Lint (24) (push) Has been cancelled
CI - Node.js / Build (24) (push) Has been cancelled
CI - Node.js / Test (24) (push) Has been cancelled
CI - Node.js / Test - Upcoming Changes (24) (push) Has been cancelled
CI - Node.js / Test - i18n (italian, 24) (push) Has been cancelled
CI - Node.js / Test - i18n (portuguese, 24) (push) Has been cancelled
CD - Docker - GHCR Images / Build and Push Images (push) Has been cancelled
951 B
951 B
id, title, challengeType, dashedName
| id | title | challengeType | dashedName |
|---|---|---|---|
| 6994cff2290543b3aec9f510 | Challenge 211: Array Sum | 28 | challenge-211 |
--description--
Given an array of numbers, return the sum of all the numbers.
--hints--
sumArray([1, 2, 3, 4, 5]) should return 15.
assert.equal(sumArray([1, 2, 3, 4, 5]), 15);
sumArray([42]) should return 42.
assert.equal(sumArray([42]), 42);
sumArray([5, -2, 7, -3]) should return 7.
assert.equal(sumArray([5, -2, 7, -3]), 7);
sumArray([203, 145, -129, 6293, 523, -919, 845, 2434]) should return 9395.
assert.equal(sumArray([203, 145, -129, 6293, 523, -919, 845, 2434]), 9395);
sumArray([0, 0]) should return 0.
assert.equal(sumArray([0, 0]), 0);
--seed--
--seed-contents--
function sumArray(numbers) {
return numbers;
}
--solutions--
function sumArray(numbers) {
return numbers.reduce((a, c) => c + a, 0);
}