Async Await (advanced Promises)

Functions that can be handled asynchronously... yes its just a promise with less steps

JavaScript Async Await
One of the hardest things about writing good JavaScript is dealing with heavily nested asynchronous code. Promises were created to solve the problem with cal...
https://www.youtube.com/watch?v=V_Kr9OSfDeU&ab_channel=WebDevSimplified

async function myFunc() {};

const myFunc = async () => {};
 
myFunc();

Return

All async functions return a promise...

async function fivePromise() { 
  return 5;
}
 
fivePromise()
	.then(resolvedValue => {
    console.log(resolvedValue); // prints: 5
  })

Await

This keyword waits for a promise to complete before carrying on with the rest of the code

Note: this only works inside of a async function

async function asyncFuncExample(){
  let resolvedValue = await myPromise();
  console.log(resolvedValue);
}
 
asyncFuncExample(); // Prints: I am resolved now!