Monday, February 23, 2015

first entry in the JavaScript object array can be accessed like

var employees = [
    {"firstName":"John""lastName":"Doe"},
    {"firstName":"Anna""lastName":"Smith"},
    {"firstName":"Peter","lastName""Jones"}
];


// returns John Doeemployees[0].firstName + " " + employees[0].lastName;


// returns John Doeemployees[0]["firstName"] + " " + employees[0]["lastName"];

No comments:

Post a Comment