Let us say I have an object Airport with members airportCode and airportCity like this:
function Airport(airportCode, airportCity) {
this.airportCode = airportCode;
this.airportCity = airportCity;
};
How can I create an array of objects Airport to which I can add. In Java, this would work like this:
while(st.hasMoreTokens()) {
Airport a = new Airport();
a.airportCode = st.nextToken();
a.airportCity = st.nextToken();
airports.add(a);
}
var airports = [];. Then, in the loop, create anAirportinstance, and add it to the array using theairports.pushmethod.stin your javascript code?