crop_rotate
Run
<!DOCTYPE html> <html> <body> <h2>JavaScript Objects</h2> <p>Access nested objects:</p> <p id="demo"></p> <script> const myObj = { name: "ali", age: 30, cars: { car1: "Ford", car2: "BMW", car3: "Fiat" } } let p1 = "cars"; let p2 = "car2"; document.getElementById("demo").innerHTML = myObj[p1][p2]; </script> </body> </html>
PCFET0NUWVBFIGh0bWw+DQo8aHRtbD4NCjxib2R5Pg0KDQo8aDI+SmF2YVNjcmlwdCBPYmplY3RzPC9oMj4NCjxwPkFjY2VzcyBuZXN0ZWQgb2JqZWN0czo8L3A+DQoNCjxwIGlkPSJkZW1vIj48L3A+DQoNCjxzY3JpcHQ+DQpjb25zdCBteU9iaiA9IHsNCiAgbmFtZTogImFsaSIsDQogIGFnZTogMzAsDQogIGNhcnM6IHsNCiAgY2FyMTogIkZvcmQiLA0KICBjYXIyOiAiQk1XIiwNCiAgY2FyMzogIkZpYXQiDQogIH0NCn0NCg0KbGV0IHAxID0gImNhcnMiOw0KbGV0IHAyID0gImNhcjIiOw0KZG9jdW1lbnQuZ2V0RWxlbWVudEJ5SWQoImRlbW8iKS5pbm5lckhUTUwgPSBteU9ialtwMV1bcDJdOw0KPC9zY3JpcHQ+DQoNCjwvYm9keT4NCjwvaHRtbD4=