Let's say I have some numbers in an array like below
let numberArray = [1, 3, 4, 6, 9, 14, 16]
I know how to sum them all up by using reduce method but how can I start adding numbers from specific element. For example:
//Sum all up by reduce
let sumAll = numberArray.reduce(0, +)
//sumAll = 53
//I want to start counting from the fourth element in the array which is 6
//so the total should be 45. [6 + 9 + 14 + 16]
What method should I use to achieve this?
Thanks in advance.