To multiply each member of an array by a scalar in JavaScript, we use the map method.
For instance, we write
const a = [1, 2, 3].map((x) => {
return x * 5;
});
to call map with a callback to return x in the [1, 2, 3] array being looped through by 5.
An array with each value in [1, 2, 3] multiplied by 5 is returned.