JSFiddle - React, Tailwind, and code Playground
by Andra Jimenez
JavaScript
//json example Nesting
var library = {
"name":"The Great Library of ALexandria",
"books":[{
"isbn": "94234-123A",
"title": "Of Mice and Men",
"pages": 102,
"autor": "John Steinbeck",
"languages": ["english", "french (translate)"],
"published":2006
},
{
"isbn": "94234-123A",
"title": "Little Red Ridding Hood",
"pages": 102,
"autor": "John Doe",
"languages": ["english", "french (translate)"],
"published":1990
},
{
"isbn": "94234-123A",
"title": "Sherlock Holmes",
"pages": 200,
"autor": "Sir Arthur Conan Doyle",
"languages": ["english", "french (translate)"],
"published":1950
}]
};
for (var key in library){
console.log("The Key is " + key + " and that value is " + library[key]);
if(key==="books"){
for(var i=0; i < library[key].length; i++){
console.log("This books name is " +library[key][i].title);
}
}
}
//can add one object to another (nesting)