Trying to learn async/await, The below code, awaits on getUserName() to return userName after 2s. hasUser (returns a promise) then just logs the received username.
The problem is console.log(msg) inside the then method logs undefined.  
function getUserName() {
    setTimeout(() => {
        return 'Appu'
    },2000)
}
var hasUser= async() => {
        var a = await getUserName()
        return a
    }
hasUser().then((msg) => {
    console.log(msg)
})
Not sure what is the problem here. Appreciate explaining what actually is going on here.
Thanks.
 
    