Coding Challenge: Sum of Values

Let's take an array of numbers as input and returning the sum of all the numbers.

Problem statement

Write a function that takes as input an array and calculates the sum of its elements. Your function should also handle negative values.

Input

values = [3, 11, 7, 2, 9, 10];

Expected output

42

Coding exercise

Get hands-on with 1400+ tech skills courses.