0

Can someone please explain the store manager quiz for me 🙂

Solution for the store manager quiz

9th Aug 2022, 9:18 AM
Frank Anthony
Frank Anthony - avatar
4 Respuestas
+ 1
We can only help you if you put the task here and copy your code. Otherwise, how do we know what you've done wrong?
9th Aug 2022, 9:40 AM
Ausgrindtube
Ausgrindtube - avatar
+ 1
Put your print out of the loop and write it: console.log(prices);
9th Aug 2022, 2:09 PM
Ausgrindtube
Ausgrindtube - avatar
0
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[i]); } } Here is the code
9th Aug 2022, 9:42 AM
Frank Anthony
Frank Anthony - avatar
0
We can do much better, we can just call a for loop telling to increase for each iteration of prices that it encounter to increase the price. function main() { var increase = parseInt(readLine(), 10); var prices = [98.99, 15.2, 20, 1026]; //your code goes here for(x in prices) //for each iteration in prices prices[x] += increase // do price + increase console.log(prices); }
31st Oct 2022, 12:27 PM
Filippo Cossu
Filippo Cossu - avatar