I have an array which looks like this:
0: 0
1: 1
2: 2
3: 3
4: 4
5: 5
6: 6
7: 7
8: 8
9: 9
10: 10
11: 11
12: 12
13: 13
14: 14
15: 15
16: 16
17: 17
18: 21
19: 22
20: 23
I want to subtract each value with the next and save that subtracted value how do I do that
So far I have done this
_this.elements.forEach(function (element, index) {
console.log(parseInt(element) - parseInt(element[index]));
});
But it keeps returning undefined