()
| 7 | |
| 8 | // Functions |
| 9 | function calculate(){ |
| 10 | const curr1Value=curr1.value; |
| 11 | const curr2Value=curr2.value; |
| 12 | |
| 13 | fetch(`https://v6.exchangerate-api.com/v6/f1d81bf4287e4cc5afe1ed17/latest/${curr1Value}`) |
| 14 | .then(res => res.json()) |
| 15 | .then(data => { |
| 16 | const rate= data.conversion_rates[curr2Value]; |
| 17 | details.innerText=`1 ${curr1Value} = ${rate} ${curr2Value}`; |
| 18 | amt2.value=amt1.value*rate; |
| 19 | }); |
| 20 | } |
| 21 | |
| 22 | function swapCurrency(){ |
| 23 | let temp=curr1.value; |