+ 1
What’s wrong in this ?
function main() { var increase = parseInt(readLine(), 10); var prices = [98.99, 15.2, 20, 1026]; //your code goes here function inc(a){ for (var i=0; i<= 4;i++) { prices[i] += increase; return prices; } } console.log(inc(prices)); }
4 Respuestas
+ 1
Why did you write the inc function in main?
0
i thought in other way to check if that will work or not. Ri He
0
function main() {
var increase = parseInt(readLine(), 10);
var prices = [98.99, 15.2, 20, 1026];
let result = []
for(let i = 0; i < prices.length; i++) {
result.push(prices[i] + increase)
}
console.log(result)
}