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);
5 Answers
+ 2
Everything ia ok. Just remove last line (console.log...)
+ 1
Why do you have console.log(c) at the end?
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));
}
0
U spelled wrong convert
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