DEV Community

Dinesh G
Dinesh G

Posted on

Async Function() method in Javascript

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();
Enter fullscreen mode Exit fullscreen mode

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);
Enter fullscreen mode Exit fullscreen mode

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...

Top comments (0)