var url = "https://api.exchangeratesapi.io/latest?base=";
async function convert(){
var base = document.getElementById('Base').value;
var out = document.getElementById('Output').value;
var amount = document.getElementById('Amount').value;
var finalValue;
let response = await fetch(`${url}${base}` ,{method:'GET'})
let data = await response.jason()
finalValue = data.rates
finalValue = finalValue[out]*Number(amount);
var result = `Converted Amount of ${amount} ${base} is ${finalValue} ${out}`
document.getElementById('Converted').innerText = result;
}
There’s a typo in code in that place.
Thank you for your reply!..Could you please tell me where I’m mistaken?
Take a look at this line:
let data = await response.jason()
Welcome there,
I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.
You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.
See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (’).
Also, for future posts, please use descriptive titles, and add your questions and added information to the body of the post.
Thank you
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.
