Похожие чаты

Function getDate() { fetch(url) .then(res => res.text()) .then(data

=> {
text = parser.parseFromString(data, 'text/xml');
});
}
console.log(text);text is always undefined outside of the asyn call chain even when i am using await, is there any way to assign it properly ??

2 ответов

7 просмотров

You are logging it before you assign it, JavaScript does not run top to bottom

return the fetch and do: getDate().then(console.log)

Похожие вопросы

Карта сайта