I want to subtract values from a array in JavaScript, but it is not a subtraction of a value from a given array
I want to do the following: I have an array any that brings me actual values from my bank. In this case I will put one to exemplify:
var arrayExemplo = [2, 5, 9, 10, 15];
I want to subtract
- element 5 by element 2
- element 9 by element 5
- element 10 by element 9
- element 15 by element 10
I want my output to go out
[3, 4, 1, 5]
How can I do this?