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

0

Please help me in js store manager project

JavaScript project

12/23/2020 4:31:28 AM

Satyam Karn

15 Answers

New Answer

+3

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

+10

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

+1

What help Satyam Karn ....please justify your doubt....

+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]; //your code goes here } help

+1

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) }

+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); }

+1

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

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 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));