spacer
Yehuda Shiran March 12, 2001
Checking for an Enumerable Property
Tips: March 2001

Yehuda Shiran, Ph.D.
Doc JavaScript

Developer News
Eclipse Helios Update Brings New PHP Tools
Internet Explorer 9 Ups Standards Support
JBoss Portal 5 Release Easier to Use

An object's property may be enumerable. An enumerable property can assume only predefined values from a given list. The variable a is enumerable:

a = new Array("jan", "feb", "march");

It can assume one of three values only: "jan", "feb", or "march". The following script defines the object Employee, where the property month is enumerable:

function Employee() {
  this.dept = "HR";
  this.manager = "John Johnson";
  this.month = new Array("jan", "feb", "mar");
}

var Ken = new Employee();

You can verify that indeed month is enumerable by:

Ken.month.propertyIsEnumerable(0);

The parameter of the method above should be numeric. Try it.


People who read this tip also read these tips:

Look for similar tips by subject:

webref The latest from WebReference.com Browse >
Flashmaps' DynamicLocator: Interactive Maps for Small Areas · Flashmaps' AreaSelector: Interactive Maps for Wide Areas · The DB Mapper: Interactive Street-level Maps of U.S. and Canada
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
MS Access and MySQL · Cisco AutoQoS: VoIP QoS for Mere Mortals · While VoIP Adoption Explodes in Enterprise, Carrier Spending Lags