Get the Sum of All Array Elements

Published by bangyen in

Create a function that takes an array and returns the sum of all numbers in the array.

Examples

sum([2, 7, 4]) ➞ 13

sum([45, 3, 0]) ➞ 48

sum([-2, 84, 23]) ➞ 105

Notes

N/A

Watch a quick demo on how Edabit works.