Can some one tell me what is with this code because the outpur is NaN instead of the values, | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Can some one tell me what is with this code because the outpur is NaN instead of the values,

function main() { var increase = parseInt(readLine(), 10); var prices = [98.99, 15.2, 20, 1026]; //your code goes here for ( let i = 0; i < prices.length; i ++){ prices[i] += increase; } for (let i = 0; i < prices.length; i++){ console.log (prices[i]) } } main();

30th Oct 2023, 7:03 AM
Shah Faisal
Shah Faisal - avatar
2 Answers
+ 2
To allow us to better troubleshoot, can you please add your code as per this instruction: https://code.sololearn.com/Wek0V1MyIR2r/?ref=app https://code.sololearn.com/W0uW3Wks8UBk/?ref=app
30th Oct 2023, 7:52 AM
Ausgrindtube
Ausgrindtube - avatar
+ 1
Shah Faisal Clear for loop 2 and leave console.log outside loop1 brackets
31st Oct 2023, 3:44 PM
Agram Mohamed
Agram Mohamed - avatar