Fixed number for all index
var array = [0, 1, 2, 3];
array.map(
function(n){
return (n* number to be multiplied);
}
);
Different number for each index
var array = [0, 1, 2, 3], numberToBeMultiplied = [1,3,5,7];
array.map(
function(n, i){
return n * numberToBeMultiplied[i];
});
You can also push
the returning elements in an array
.
solved How to multiply each element in an array with a different number (javascript) [closed]