Async Function() method in Javascript



This content originally appeared on DEV Community and was authored by Dinesh G

Async function() method in javascript

An async function in JavaScript is a special type of function designed to work with asynchronous operations, making them appear more synchronous and easier to manage using the await keyword.

Await only in Async function.

Eg:

Async function dev() {
 await task ("analysis")
 await task ("design")
 await task ("plan")
 await task ("deploy")
}
dev();

Eg code:

function account(amount){
let balance = amount;
function withdraw (amt){
balance = balance.amt;
console.log(balance):
}
return withdraw;
}
const withdraw 1=account(1000);
withdraw 1(50);
const withdraw 2=account(500);
withdraw 2 (100);

API calling in js :

API calls in java script are primary mode to interout with web series and retrieve or send data the most common and recommeded method us making API calls in modern.

Happy coding…


This content originally appeared on DEV Community and was authored by Dinesh G