а при вставке в html [object Promise] почему так?
А как ты вставляешь?
document.querySelector('.container').textContent = getDirectory(url);
document.querySelector('.container').textContent = await getDirectory(url);
Uncaught SyntaxError: await is only valid in async functions and the top level bodies of modules
Ну либо оберни все это в функцию, либо: getDirectory(url).then(result => document.querySelector('.container').textContent = result)
Обсуждают сегодня