You are given an array of integers nums.
Your task is to return the sum of all the numbers in the array.
You may assume that:
nums can be empty, in which case the sum is 0.nums is an integer that can be negative, zero, or positive.[1, 2, 3, 4, 5]
15
The sum of all elements is 1 + 2 + 3 + 4 + 5 = 15.
[10, -3, 7]
14
The sum is 10 + (-3) + 7 = 14.
[]
0
An empty array has a sum of 0.
[1, 2, 3, 4, 5]
15