faqts : Computers : Programming : Languages : JavaScript : XML : E4X (ECMAScript for XML) : XMLList objects

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

4 of 6 people (67%) answered Yes
Recently 4 of 6 people (67%) answered Yes

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'
  */