Nodejs
Async ... Await Function in JavaScript
In JavaScript, async and await are keywords used to work with asynchronous code in a cleaner and more readable way. They are part of modern JavaScript introduced with ES2017 (ES8). These features make it easier to handle asynchronous operations, like fetching data from a server or reading a file, without getting tangled in callback hell or chaining long .then() calls in Promises.
async Keyword
The async keyword is used to declare a function as asynchronous. An async function always returns a Promise. If the function explicitly returns a value, the Promise resolves with that value. If it throws an error, the Promise is rejected with the error.
<script>
async function abc(){
console.log("2nd Message");
await console.log("3rd Message");
console.log("4th Message");
}
console.log("1st Message");
abc();
console.log("5th Message");
</script>