MCPcopy Create free account
hub / github.com/codemistic/Web-Development / calculate

Function calculate

Currency-Exchange-Rate-Calculator/script.js:9–20  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

7
8// Functions
9function 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
22function swapCurrency(){
23 let temp=curr1.value;

Callers 1

swapCurrencyFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected