Question: I've been really intrigued about `async / await` syntax recently and I've been experimenting with it for a while.  

In this particular problem, my goal is to execute the callback function after all the promises are made, if possible. 

I had no idea how to apply my ideas in real life situations so I expected the function to look like this. 

```js

function endTask (task) {
   // finalizes tasks 
}

var taskCompleted = false; 

async function doSomething (callback) {
   const response = await fetch(some_url);
   const task = await response.json(); 

    if (task) { 
     taskCompleted = true; 
    }
   if (typeof callback == "function" && taskCompleted) {
   callback(task); 
}
}

doSomething(endTask); 

```

Answer: 
The purpose of the async/wait functionality is to reduce the complexity called [Callback Hell](http://callbackhell.com/). Async functions effectively removes the necessity of passing around callback functions.

However, one can still pass a callback function to an async function as a reference to be called later in his logic. This is perfectly alright as long as the developers do not go to the extent of wrapping Promises around async functions. That application goes against the concept of async/await.

Async functions always take parameters in real practice and some of them are callback functions which are to be called immediately or pass on to another function. 

Shorthand version of your code:

```
function endTask (task) {
   // finalizes tasks 
}

async function doSomething () {
   const response = await fetch(some_url);
   const task = await response.json(); 

   if (typeof callback == "function" && task) {
      endTask (task); 
}
}

doSomething(); 

```
Yes, `async` functions can take and call callbacks just like any other function, but that pretty much defeats the purpose of using an `async` function. There are some cases where there is a valid reason to do this (see Dave Newton's comment below), but this isn't one of them.

Instead, you should do something like this:

```
function endTask(task) {
  // finalizes tasks 
}

var taskCompleted = false;

async function doSomething() {
  const response = await fetch(some_url);
  const task = await response.json();

  return task;
}

doSomething()
    .then(task => {
        if (task) {
            taskCompleted = true;
        }
        endTask(task);
    })
    .catch(error => {
        // handle error
    });  

```