- 3

store manager porject in javascript

Hi all I have written my code (I have tried) and now I am stuck as it only changes the first value. mu output is: 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; i++); { prices[i] +=increase; console.log(prices); } } I should be showing: [ 107.99, 24.2, 29, 1035 ] but i have :[ 107.99, 15.2, 20, 1026 ] please may I ask for some help and where I have gone wrong please.

3rd May 2021, 10:57 AM
shycoo
5 ответов
+ 2
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++) { prices[i] += increase } console.log(prices) }
30th Aug 2022, 5:13 PM
Charis Cheung
Charis Cheung - avatar
+ 1
You should repeat the material covered, since you managed to make 3 mistakes in one cycle ☺️ 👇 👇 for (var i=0; i>prices.length; i++); { pricesil+=increase; console.log(prices); 🤔 }
3rd May 2021, 12:17 PM
Solo
Solo - avatar
0
function main(){ var increase = parseInt(readLine(), 10); var prices = [98.99, 15.2, 20, 1026]; //your code goes here var newprice = []; for (const i in prices) { newprice.push(prices[i] + increase); } console.log(newprice); }
9th Oct 2021, 9:20 AM
Ritesh
Ritesh - avatar
0
function main() { var increase = parseInt(readLine(), 10); var prices = [98.99, 15.2, 20, 1026]; //your code goes here var pl = prices.length; for(i=0; i<pl;i++){ prices[i]+=increase } console.log(prices) }
7th Apr 2022, 6:58 AM
Nikola M.
Nikola M. - avatar
- 1
The error is in the code, on one of the lines, with one of the things.
3rd May 2021, 11:10 AM
zxtychj
zxtychj - avatar