Create Store Manager | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Create Store Manager

Here is my solution with two methods. function main() { var increase = parseInt(readLine(), 10); var prices = [98.99, 15.2, 20, 1026]; //your code goes here var newPrices = prices.map(price => price + increase) console.log(newPrices) /* var newprices = []; for(var i = 0; i < prices.length; i++) { newprices[i] = prices[i] + increase; } console.log(newprices)*/ }

27th Jun 2022, 10:46 AM
Nasir Mahmood
Nasir Mahmood - avatar
4 Answers
+ 4
And your question is?
27th Jun 2022, 11:06 AM
A͢J
A͢J - avatar
0
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.
27th Jun 2022, 4:52 PM
Nasir Mahmood
Nasir Mahmood - avatar
0
Please read the above question to get an idea about answer I posted earlier.
27th Jun 2022, 4:53 PM
Nasir Mahmood
Nasir Mahmood - avatar
0
It still doesn't have your question. Pls write it.
27th Jun 2022, 5:31 PM
Emerson Prado
Emerson Prado - avatar