OBJECT
var myCat = {"name": "Meowalot",
"species": "cat",
"favFood": "tuna"
}
ARRAY
var myFavColors = ["blue", "green", "purple"];JSON
var thePets = [{
"name": "Meowalot",
"species": "cat",
"favFood": "tuna"
},
{
"name": "Barky",
"species": "dog",
"favFood": "carrots"
}
]
console.log(thePets[1].favFood); // this will return the value of carrots
console.log(thePets[1]); // returns the 2nd
// AJAX
Comments
Post a Comment