In this section, you're finally going to get to use the new async/await functionality. We're going to create an alternative version of the getStatus function and call it getStatusAlt, so we can go ahead and actually define that: a const getStatusAlt. Now, it's still going to be a function, so we're going to start off by creating an arrow function (=>). We're still going to take in an argument, so we'll define that userId:
const getStatusAlt = (userId) => {
};
Now, though, we're going to switch things up. Instead of working through the old example, we're going to use the new async/await functionality. To explore this, let's temporarily comment out the getStatus-then and catch block code. We'll be recreating it with a call to getStatusAlt as opposed to a call to getStatus, but I do want to leave the old code in place so we can directly compare and contrast the differences.
The new async/await functionality is going to allow us to write our old code in a way that looks like synchronous code, which means that we'll be able to avoid things like then callbacks, promise chaining, and workarounds. With async/await, we're going to able to avoid all of that stuff, creating a function that's just a whole lot easier to read, alter, work with, and test. Now, getStatusAlt is going to start off in a way that is super boring.
We're going to return a string, Mike:
const getStatusAlt = (userId) => {
return 'Mike';
};
This is the JavaScript 101 stuff. You would expect Mike to come back. If I use consult.log, his name should pop out through getStatusAlt.
const getStatusAlt = (userId) => {
return 'Mike';
};
console.log(getStatusAlt());
Let's just go ahead and work through this, so we're going to save the file, nodemon is going to restart, and there we go. We have Mike printing to the screen:

That's exactly what we would expect. Now, with async/await, we actually mark our functions as special functions. I have a few functions here. We're going to be marking return 'Mike' as a special async function. So in the future, async/await are going to be two words async and await. These aren't just words, but actual keywords that we're going to be typing out.