javascript add 1 to each element in array
var numberarr2 = numberarr.map( function(value) { return value - 1; } );
Here is what the above code is Doing:
1. We create an array of numbers.
2. We create a new array by mapping the first array.
3. We subtract 1 from each value in the first array and return it.
4. We store the new array in a variable.