has own propriety javascrip code example
Example 1: has own propriety javascrip
var x = {
y: 10
};
console.log(x.hasOwnProperty("y")); //true
console.log(x.hasOwnProperty("z")); //false
Example 2: has own propriety javascrip
if (someVar.hasOwnProperty('someProperty') ) {
// do something();
} else {
// do somethingElse();
}