From
https://www.joshwcomeau.com/javascript/promises/
After problems with Promises were established, a version 3 technology was released and called Async / Await.
Sample code
1 | <html> |
The trick about Async/Await is that they can only be called from within Async functions. So out handler was modified
document.addEventListener('DOMContentLoaded', async function () {
console.log('DOM fully loaded and parsed.');
});