logo
logo

First 2 Sum

First 2 Sum

Create a function
sumArray
that takes in an array of numbers and uses array destructuring to add the first two elements of the array. If the array has less than two elements, return 0. For example,
sumArray([2, 3, 6])
would return 5.
Console
Submit
Solution
00:00