The first one, await, will eventually get used inside of our async functions but, before we can ever use await, we have to mark that function as async, so we're going to do that first. We're going to explore it, then we'll move on to await. In the getStatusAlt variable line, all we're going to do is add async in front of our arguments list with a space:
const getStatusAlt = async (userId) => {
return 'Mike';
};
Now, this is actually going to change how the console.log works; to explore that, all we're going to do is save the file and see what we get. Instead of getting the string Mike back, you can see we're now getting a Promise back:

We're getting a promise back that resolves the string Mike, so this brings us to the first big difference between regular functions and async functions. Regular functions return strings and strings come back; async functions always return promises. If you return something from an async function, it's actually returning a promise and it's resolving the value. So this function is equivalent to the following code. You don't have to write this out; this is just to get the idea. It is equivalent to creating a function that returns a new promise where that new promise gets resolve and reject, and it then calls resolve with Mike:
() => {
return new Promise((resolve, reject) => {
resolve('Mike')
})
}
These two are identical, they have the exact same functionality. We create a new promise, we resolve Mike or we use an async function that simply returns something.
In place of console.log statement, I'm going to call getStatusAlt. This time we're getting a promise back and we know that, so we can just use the then callback. What are we going to get back? We're going to get back the return value as our resolved value.
If I return to string, I'd get a string back; here a number, I'd get a number; a Boolean, an object, a function; whatever you explicitly return from this function is going to be available as if it was resolved, which means that I can create a name variable like a console.log(name):
const getStatusAlt = async (userId) => {
return 'Mike';
};
getStatusAlt().then((name) => {
console.log(name);
});
Now, what are we going to get back inside nodemon? We're just going to get back Mike once again, the regular plain old string. Because we've added on a piece of promise-based chaining, we then get the name and we print it out, and here Mike prints once again:

So, if returning a value is equivalent to resolving, how do we reject?