What will be return from the function

function findUser(id){
    //some logic to find user
    return
    {
        name: "JS",
        age: 29
    }
}

Answer

undefined

Explanation

return always end in single line or has automatic semicolon, unless there is a block of multiline code.

  • below code will work
<code>return { name: "JS", age: 29, };</code>
  • below code will not work
<code>return { name: "JS", age: 29 }</code>