You use object.hasOwnProperty ( p ) to determine if an object has an enumerated p property -
an object can have its own prototype, where default methods and attributes are assigned to each instance of the object. hasOwnProperty returns true only for properties that were specially set in the constructor or added to the instance later.
to determine if p is defined at all, anywhere, for an object, use if ( p is an instance of the object), where p evaluates the property name string.
For example, by default, all objects have a 'toString' method, but it will not be displayed in hasOwnProperty.
kennebec Feb 22 '12 at 14:45 2012-02-22 14:45
source share