DEV Community

Discussion on: With great prototype power comes great responsibility

Collapse
 
budyk profile image
Budy

let Object.prototype.hasOwnProperty() to the rescue

if (obj.hasOwnProperty('a')) {

}
Collapse
 
karataev profile image
Eugene Karataev

Yeah, thanks for mentioning this method. But using hasOwnProperty will console.log different result in the post's example, so use it with caution.