- 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)) }

24th Dec 2020, 12:54 PM
Alim Niyazov
Alim Niyazov - avatar
3 odpowiedzi
+ 3
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; }
24th Dec 2020, 1:06 PM
TheWh¡teCat 🇧🇬
TheWh¡teCat 🇧🇬 - avatar
+ 7
Rewrite the convert function like : function convert(a,b) { return a*b ; }
24th Dec 2020, 1:03 PM
Alphin K Sajan
Alphin K Sajan - avatar
0
thank you very much for making such stupid mistakes
24th Dec 2020, 1:10 PM
Alim Niyazov
Alim Niyazov - avatar