March 12, 2001 - Checking for an Enumerable Property
![]() |
March 12, 2001 Checking for an Enumerable Property Tips: March 2001
Yehuda Shiran, Ph.D.
|
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.



