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

21st Dec 2020, 8:04 AM
Jayanth
Jayanth - avatar
4 Respuestas
+ 1
Why did you write the inc function in main?
21st Dec 2020, 9:51 PM
Ri He
Ri He - avatar
0
i thought in other way to check if that will work or not. Ri He
22nd Dec 2020, 6:11 AM
Jayanth
Jayanth - avatar
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) }
10th Feb 2021, 10:23 PM
Lx Muliar
Lx Muliar - avatar