- 1

Can someone please explain to me how to solve the currency converter question on JavaScript?

You are making a currency converter app. Create a function called convert, which takes two parameters: the amount to convert, and the rate, and returns the resulting amount. The code to take the parameters as input and call the function is already present in the Playground. Create the function to make the code work. Sample Input: 100 1.1 Sample Output: 110

10th Jan 2022, 10:24 AM
Stephen Sunday
Stephen Sunday - avatar
5 Réponses
0
Please show your attempt first
10th Jan 2022, 10:46 AM
Kamil Hamid
Kamil Hamid - avatar
0
Kamil Hamid function convert(amount, rate) {return amount*rate ;} var x =convert (100, 1.1) console.log(convert(100, 1.1));
12th Jan 2022, 6:14 AM
Stephen Sunday
Stephen Sunday - avatar
0
I didn’t think that this was a thing. I’ve tried with different variations and even just the arithmetic, and it seems like js can’t do some certain multiplications. This must be due to the design of the language itself, so I don’t think that this is on your half, but is in fact the way the language was designed? I will see if I can find a way around it but until then I hope you know that this must be a fault in the language
12th Jan 2022, 8:49 AM
Kamil Hamid
Kamil Hamid - avatar
0
Could I ask if you are using normal javascript or node.js?
12th Jan 2022, 9:13 AM
Kamil Hamid
Kamil Hamid - avatar
0
Its node.js
12th Jan 2022, 10:00 PM
Stephen Sunday
Stephen Sunday - avatar