 Please help me in js store manager project | Sololearn: Learn to code for FREE!

0

JavaScript project

+5

You need to initiative an empty array to store the new prices, then loop over the prices array, then add each old price with increase variable and lastly append the sum to the new price array. e.g 1. newPrice =[]; //empty array 2. Use the forloop to get item index in array price array 3. newPrice.push(price[index] + increase); // append the new price to array 4.console.log(newPrice) // print out the array

+8

function main() { var increase = parseInt(readLine(), 10); var prices = [98.99, 15.2, 20, 1026]; //your code goes here for(var i=0; i<=prices.length-1; i++){ prices[i]= prices[i] + increase; } console.log(prices); }

+3

function main() { var increase = parseInt(readLine(), 10); var prices = [98.99, 15.2, 20, 1026]; //your code goes here for (i=0; i<4; i++){ prices[i] = increase + prices[i]; } console.log(prices) }

+2

function main() { var increase = parseInt(readLine(), 10); var prices = [98.99, 15.2, 20, 1026]; //your code goes here function newPrices (increase){ prices= prices+ increase.toNumber prices= prices+ increase.toNumber prices= prices+ increase.toNumber prices= prices+ increase.toNumber return prices } console.log(prices) } What do I do next? I'm only getting one of the test cases

+1

+1

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. This is my question

+1

function main() { var increase = parseInt(readLine(), 10); var prices = [98.99, 15.2, 20, 1026]; for(var i=0; i<prices.length; i++) prices[i] += increase; console.log(prices); }

0

I was lerning js and sen a question in project store manager

0

function main() { var increase = parseInt(readLine(), 10); var prices = [98.99, 15.2, 20, 1026]; //your code goes here } help

0

function main() { var increase = parseInt(readLine(), 10); var prices = [98.99, 15.2, 20, 1026]; //your code goes here var newPrice = new Array(); for (var i=0;i< prices.length ; i++){ newPrice[i] = prices[i]+increase; } console.log(newPrice); }

0

function main() { var increase = parseInt(readLine(), 10); var prices = [98.99, 15.2, 20, 1026]; //your code goes here for(var i=0;i<=prices.length-1;i++){ prices[i]=prices[i]+increase; } console.log(prices); } its working

0

function main() { var increase = parseInt(readLine(), 10); var prices = [98.99, 15.2, 20, 1026]; //your code goes here for(var i=0;i<=prices.length-1;i++){ prices[i]=prices[i]+increase; } console.log(prices); } its working

0

For(var I=0:; I<=prices.length-1; I++) { Prices[i]= prices[i] + increase; } Console.log(prices);

0

console.log(prices.map(e => e + increase));

0

for (var i = 0; i < prices.length; i++) { prices[i] = prices[i] + increase; } console.log(prices); }