我得到了这样的承诺,我怎样才能从中提取数据并将其放入变量中?
编码:
async function fetchDate(key, zone) {
const result = await fetch(`http://api.timezonedb.com/v2.1/get-time-zone?${key}&format=json&by=zone&zone=${zone}`);
return result;
}
let result = fetchDate(key, newYorkZone);
let newYorktime = result.then(json => json.json());
console.log(newYorktime)