- 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
5 Answers
0
Please show your attempt first
0
Kamil Hamid
function convert(amount, rate) {return amount*rate ;}
var x =convert (100, 1.1)
console.log(convert(100, 1.1));
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
0
Could I ask if you are using normal javascript or node.js?
0
Its node.js