0
Can someone please explain the store manager quiz for me 🙂
Solution for the store manager quiz
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?
+ 1
Put your print out of the loop and write it: console.log(prices);
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
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);
}