in (Operator/logical)

Test for the existence of a property in an object.

Availability:

ECMAScript edition - 3
JavaScript - 1.5
JScript - 5.0
Internet Explorer - 5.0
Netscape - 6.0
Property/method value type:Boolean primitive
JavaScript syntax:-aProperty in anObject
Argument list:aPropertyA specific property to test for the existence of

The object is examined to see if the property exists. If it does, then a Boolean true value is returned, otherwise the expression returns false.

This might be useful as a work-around for when you need to test for the existence of a property but to do so by referring to it directly might cause a run-time error.

The logical operator yields true if the property exists in the object and false if the property is not available.

Warnings:

Cross-references:

ECMA 262 edition 3 - section - 11.8.7