@rod It's nothing special, it's just a habit that I have trained myself into.
The reason I check for the existence of app.user is because you cannot reference an object property (that is, the uid property of the user object in app) if the object itself does not exist. You'll get a javascript error (ReferenceError: user is not defined).
If there's even a chance the parent object is not defined, I make a check for it first (though app is always defined in NodeBB, so I skip that).
The proper way to write it would be: if (app.hasOwnProperty('user')), but even sometimes that can be tripped up if app.user is a property, but undefined 😄