[Help needed] Javascript practise - currency converting | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

[Help needed] Javascript practise - currency converting

Hi all ! I have difficulties to achieve this practise. This is my code and I can't see what is wrong. I have the error "NaN" in every test cases... function main() { var amount = parseFloat(readLine(), 10); var rate = parseFloat(readLine(), 10); function convert(montant, taux) { var nvxMontant = montant * taux; return nvxMontant; } console.log(convert(amount, rate)); } main(); Could someone help me please ?

9th Aug 2021, 11:05 AM
Kaemyll Selendaer
Kaemyll Selendaer - avatar
2 Answers
+ 3
In Sololearn challenges, main() function is called by compiler itself. It's not necessary to call in your solutions. //main();
9th Aug 2021, 11:26 AM
Simba
Simba - avatar
+ 1
Thanks !
9th Aug 2021, 12:11 PM
Kaemyll Selendaer
Kaemyll Selendaer - avatar