crop_rotate
Run
<!DOCTYPE html> <html> <body> <h2>Nested JavaScript Objects and Arrays.</h2> <p id="demo"></p> <script> let x = ""; const myObj = { name: "Mohamed", age: 30, cars: [ {name:"Ford", models:["Fiesta", "Focus", "Mustang"]}, {name:"BMW", models:["320", "X3", "X5"]}, {name:"Fiat", models:["500", "Panda"]} ] } for (let i in myObj.cars) { x += "<h2>" + myObj.cars[i].name + "</h2>"; for (let j in myObj.cars[i].models) { x += myObj.cars[i].models[j] + "<br>"; } } document.getElementById("demo").innerHTML = x; </script> </body> </html>
PCFET0NUWVBFIGh0bWw+DQo8aHRtbD4NCjxib2R5Pg0KDQo8aDI+TmVzdGVkIEphdmFTY3JpcHQgT2JqZWN0cyBhbmQgQXJyYXlzLjwvaDI+DQo8cCBpZD0iZGVtbyI+PC9wPg0KDQo8c2NyaXB0Pg0KbGV0IHggPSAiIjsNCmNvbnN0IG15T2JqID0gew0KICBuYW1lOiAiTW9oYW1lZCIsDQogIGFnZTogMzAsDQogIGNhcnM6IFsNCiAgICB7bmFtZToiRm9yZCIsIG1vZGVsczpbIkZpZXN0YSIsICJGb2N1cyIsICJNdXN0YW5nIl19LA0KICAgIHtuYW1lOiJCTVciLCBtb2RlbHM6WyIzMjAiLCAiWDMiLCAiWDUiXX0sDQogICAge25hbWU6IkZpYXQiLCBtb2RlbHM6WyI1MDAiLCAiUGFuZGEiXX0NCiAgXQ0KfQ0KDQpmb3IgKGxldCBpIGluIG15T2JqLmNhcnMpIHsNCiAgeCArPSAiPGgyPiIgKyBteU9iai5jYXJzW2ldLm5hbWUgKyAiPC9oMj4iOw0KICBmb3IgKGxldCBqIGluIG15T2JqLmNhcnNbaV0ubW9kZWxzKSB7DQogICAgeCArPSBteU9iai5jYXJzW2ldLm1vZGVsc1tqXSArICI8YnI+IjsNCiAgfQ0KfQ0KDQpkb2N1bWVudC5nZXRFbGVtZW50QnlJZCgiZGVtbyIpLmlubmVySFRNTCA9IHg7DQo8L3NjcmlwdD4NCg0KPC9ib2R5Pg0KPC9odG1sPg==