Tried several times. Please, check my code & help me to solve the problem! | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Tried several times. Please, check my code & help me to solve the problem!

JavaScript project: store manager. Question: 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. My code: function main() { var increase = parseInt(readLine(), 10); var prices = [98.99, 15.2, 20, 1026]; //your code goes here for(i=0; i<prices.length; i++) { function increasePrice() { return console.log(increase + prices[i]) ; } } }

19th Feb 2021, 6:14 AM
Imtiaz Faisal
Imtiaz Faisal - avatar
2 Answers
+ 1
You need to loop over the array and increase each price in the array and then after the loop output the entire array to the console.
19th Feb 2021, 6:38 AM
ChaoticDawg
ChaoticDawg - avatar
0
Gratitude ChaoticDawg! Problem solved 😊
19th Feb 2021, 8:52 AM
Imtiaz Faisal
Imtiaz Faisal - avatar