EN
Node.js - How to make anonymous async functions?
1
answers
0
points
Is it possible to create an asynchronous function without declaring its name (anonymous function)?
For example, how can I make the following function anonymous?
const asyncFunction = async () => {
const response = await fetch('API');
// some code...
}
asyncFunction();
1 answer
0
points
It's called Immediately Invoked Function Expression and that executes functions as soon as they are created.
(async () => {
const response = await fetch('https://some-domain.com/path/to/api');
// some code...
})();
Check this:
0 comments
Add comment