0

the currency converter

hello guys I've just started learning JS and I don't know what I'm doing wrong in the currency converter test. this is my code can you tell me what's wrong? function main() { var amount = parseFloat(readLine(), 10); var rate = parseFloat(readLine(), 10); console.log(convert(amount, rate)); } function covert(amount, rate){ var c = amount * rate; return c; } console.log(c);

18th Jan 2021, 9:26 AM
needless sword58
needless sword58 - avatar
5 Answers
+ 2
Everything ia ok. Just remove last line (console.log...)
18th Jan 2021, 9:38 AM
george
george - avatar
+ 1
Why do you have console.log(c) at the end?
18th Jan 2021, 9:36 AM
Abhay
Abhay - avatar
0
thank you guys found out the prob <3 function main() { var amount = parseFloat(readLine(), 10); var rate = parseFloat(readLine(), 10); function convert(amount, rate){ var c = amount*rate; return c; } console.log(convert(amount, rate)); }
18th Jan 2021, 9:41 AM
needless sword58
needless sword58 - avatar
0
U spelled wrong convert
8th Apr 2021, 8:37 AM
Harshita Kumari
Harshita Kumari - avatar
0
Did u fix that ?You're close! The issue is in your function name. It should be convert, not covert. Also, remove console.log(c); from the end. Here's the corrected code: javascript Копіювати код function main() { var amount = parseFloat(readLine(), 10); var rate = parseFloat(readLine(), 10); console.log(convert(amount, rate)); } function convert(amount, rate){ return amount * rate; } For real time info check out all about international rates web platform https://rates.fm/ for insights
22nd Sep 2024, 6:21 AM
Odessa
Odessa - avatar