We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 11dbe2e commit 958dcedCopy full SHA for 958dced
demo.js
@@ -23,15 +23,15 @@ async function fetchData(url) {
23
}
24
25
26
-//function to convert any currency to INR using a fixed exchange ratefunction
+//function to convert any currency to INR using a fixed exchange rate function
27
function convertToINR(amount, currency) {
28
const exchangeRates = {
29
USD: 74.85,
30
EUR: 88.50,
31
GBP: 103.20,
32
JPY: 0.68
33
};
34
- if (exchangeRates[currency]) {
+ if (Object.hasOwn(exchangeRates, currency)) {
35
return amount * exchangeRates[currency];
36
} else {
37
throw new Error('Unsupported currency');
0 commit comments