Entry
How do I use the method propertyIsEnumerable?
How do I use the method propertyIsEnumerable?
Apr 16th, 2005 03:03
Martin Honnen,
The method propertyIsEnumerable takes one argument, the property name to
check, and returns a boolean value indicating whether the property is
included in a for..in enumeration loop or not. The method returns true
if the property name converted to a number is greater than or equal to 0
and less than the length of this XMLList.
Here are some examples:
var godList = <>
<god>Kibo</god>
<god>Xibo</god>
</>;
alert(godList.propertyIsEnumerable(0)); // shows 'true'
alert(godList.propertyIsEnumerable(1)); // shows 'true'
alert(godList.propertyIsEnumerable(2)); // shows 'false'
for (var propertyName in godList) {
alert(propertyName);
}
/* shows
'0'
'1'
*/