Right now I am working on this function to litterlay sum up.
The array looks for example like this: var array = ['5','2','8'];
I want to litterly say array[0] +1 or something like this.
I look at reduce but that sums up all the values with each other, that is not what it is supposed to do. What should come out is when sum is 1, and you want the first value in the array. In this case is the first one is 5 : 5 + 1 = 6. Then 6 should come out of it and replace the place of 5 in the array.
This is an example of what I got right now.
var array = ['6','2','5'];
for(var i = 0; i < array.length; i++){
array = array[i];
var sum = 1;
array = sum + array[0];
console.log(array);
}
arrayand it becomes not clear, what you like to achieve.