You have defined person as an object not as an array. You can probably ise multi-dimensional arrays for that.
In fact, this code works:
function Person(firstName, lastName, phoneNumber) {
this.firstName = firstName;
this.lastName=lastName;
this.phoneNumber=phoneNumber;
}
person = new Object();
person[0] = new Person("John","Smith","555 1234");
person[1] = new Person("Bill","Robinson","555 6789");
person[2] = new Person("Jane","Doe","555 6753");
document.writeln("<ol>")
for (personNumber in person) {
document.writeln("<li>" + person[personNumber].lastName + ", " + person[personNumber].firstName + ": " + person[personNumber].phoneNumber + "</li>");
}
document.writeln("</ol>");
It works regardless of whether I use Array or Object. Objects and arrays seem to be synonymous - if someone would give me a clear explanation of the difference I'd much appreciate it. The trick is to make each array element an object in its own right and to have a constructor for the class.
Took a while; ho hum.