0
How yo add an array
If I have an array of predetermined numbers I.e. Var prices = [10, 20, 30, 40]; And the user inputs me a value I.e. Var increase = parseInt ( input()); How can I program JavaScript to add the user increase to my original array and output the new array? I.e. Input = 2 Output [12, 22, 32, 42]
4 odpowiedzi
+ 1
var prices_inc = prices.map(v => v+increase);
+ 1
Thanks!
0
It worked!! Could tou explain to me what the .map and de V=> do?