Sign In
Curriculum
First 2 Sum
Mark as Completed
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.
Click to go back
Click to go forward
Refresh preview
Console
Submit
Solution
00:00
Previous Lesson
Next Lesson