Store Manager | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок
+ 1

Store Manager

You are working on a Store Manager program, which stores the prices in an array. You need to add functionality to increase the prices by the given amount. The increase variable is taken from user input. You need to increase all the prices in the given array by that amount and output to the console the resulting array. function main() { var increase = parseInt(readLine(), 10); var prices = [98.99, 15.2, 20, 1026]; //your code goes here }

1st Jan 2023, 4:08 PM
Majd alkouz
Majd alkouz - avatar
1 ответ
0
prices.forEach(function(item, index, arr){ arr[index] = item + increase; }); console.log(prices);
1st Jan 2023, 6:09 PM
SoloProg
SoloProg - avatar