js isset

JavaScript
if (typeof obj.foo !== 'undefined') {
}if (typeof obj.foo !== 'undefined') {
  // your code here
}

Source

Also in JavaScript: