Working on my JavaScript skills I'm stuck on this bit was wondering if anyone could help please?
Objective: is to store value from request and place it in a globally accessible variable.
const CurreField = document.querySelector('#cctype');
const AmountFields = document.querySelector('#curAmount');
let data_test ="";
async function getValue() {
const results = await fetch("https://api.exchangeratesapi.io/latest")
const data = await results.json();
const value_pick = data.rates.USD
return value_pick
}
let get_data;
getValue().then(data => {
get_data = data;
});
let value_manipulate = get_data // not sure how to fix this bit
// I want to achieve a console.log(value_manipulate)