Possible Duplicate:
javascript test for existence of nested object key
if (typeof MyApp != 'undefined' &&
typeof MyApp.User != 'undefined' &&
typeof MyApp.User.current != 'undefined' &&
typeof MyApp.User.current.language != 'undefined') {
console.log(MyApp.User.current.language);
}
this feels wrong. Can this if statement be written in some nicer way?