HasProperty() (Function/internal)

Internal private function to test for the existence of a property.

Availability:

ECMAScript edition - 2

This internal function returns a Boolean value indicating whether the object contains the named property.

If the receiving object has the property, then the result is true.

If the receiving object does not, then the prototype chain is walked until the property is found or the chain is exhausted.

If a null prototype is found, the false value is returned.

Host objects may or may not strictly honor the intent of this internal function. The ECMA standard allows for the possibility that a host object may still properly manage Get and Put internal functions, even if the HasProperty function returns false for the properties being accessed.

To cope with that eventuality, ECMAScript edition 3 provides a way to test whether an object has a property of its own, but this test ignores the prototype inheritance. You might simulate that by walking up the prototype chain, testing objects as you go.

See also:Attribute object, Attributes object, Host object, Internal Method, Object.hasOwnProperty()

Cross-references:

ECMA 262 edition 2 - section - 8.6.2.4

ECMA 262 edition 3 - section - 8.6.2.4