Currency converter, can you point out errors? | Sololearn: Learn to code for FREE!

-2

Currency converter, can you point out errors?

function main() { var amount = parseFloat(readLine(), 10); var rate = parseFloat(readLine(), 10); console.log(convert(amount, rate)); } function convert(a;b){ return = a*b; console.log(convert (100;1.1)) }

12/24/2020 12:54:55 PM

Alim Niyazov

3 Answers

New Answer

+4

Alim Niyazov , first you don't need to print with specific values =>console.log(convert(100, 1.1). Replace semicolons with commas between the function parameters and arguments. You can't say return = a * b. Instead write return a * b try this way : function main() { var amount = parseFloat(readLine(), 10); var rate = parseFloat(readLine(), 10); console.log(convert(amount, rate)); } function convert(a,b){ return a*b; }

+7

Rewrite the convert function like : function convert(a,b) { return a*b ; }

0

thank you very much for making such stupid mistakes