I have an object nested within a property of a parent object. I need to find out if a
property exist.
var o = {
prop: {
a: 'a',
b: 'b'
}
}
Here are two approaches:
o.prop.hasOwnProperty('a'); // true
!!o.prop.a // true
What is the difference between the two? Any other alternatives?