Im new to programming and am confused about the async function present in the javascript language. Why do you use it, and how?
Short demo:
function resolveAfter2Seconds() {
return new Promise(resolve => {
setTimeout(() => {
resolve('resolved');
}, 2000);
});
}