Convert currency | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Convert currency

function convert(amount,rate){ return amount*rate; } console.log(convert(42,0.72)); console.log(convert(1050,9.4)); //convert(42,0.72); //convert(1050,9.4); No matter what I do I can’t pass this project What I’m missing , can you help please

11th Jan 2021, 4:47 PM
Saif Aljubori
Saif Aljubori - avatar
2 Answers
+ 1
Saif Aljubori , don't call your convert function with specific values, because they're read as input. Why do you remove the main function where input variables are read to test your code. According to your code it can be changed to : function main() { var amount = parseFloat(readLine(), 10); var rate = parseFloat(readLine(), 10); console.log(convert(amount, rate)); } function convert(amount,rate){ return amount*rate; }
11th Jan 2021, 5:17 PM
TheWh¡teCat 🇧🇬
TheWh¡teCat 🇧🇬 - avatar
0
thanks a lot
11th Jan 2021, 5:29 PM
Saif Aljubori
Saif Aljubori - avatar