+ 5

Why this error?

I solved code coach problem with this code and that was working there, but when I saved this code and trying to run the code it give me an error why this happen? Maybe this feature is disabled in SL IDE!! https://code.sololearn.com/cDSkroK4EleU/?ref=app

6th Jan 2021, 7:44 AM
Tarun Gautam
Tarun Gautam - avatar
1 Antwort
+ 4
The increase var is assigned to a readline() function, your code does not have access to it, thus var increase = parseInt(readLine(), 10); Comes up as undefined This function was not visible in the challenge to prevent cheating, so you didn't get it when copying the whole code Try using a value your code can access, instead of the function, and add a line that will generate output. Do following: function main() { var increase = 4; var prices = [98.99, 15.2, 20, 1026] for(i=0; i<prices.length; i++){ prices[i]+=increase } console.log(prices); } main()
6th Jan 2021, 7:58 AM
Qwerty Uiop
Qwerty Uiop - avatar