how to check wether the property exist in a object in java script

Java
if (obj.hasOwnProperty('prop')) {
    // do something
}
Source

Also in Java: