crop_rotate
Run
<!DOCTYPE html> <html> <body> <h2>JavaScript Objects</h2> <p>Access nested objects:</p> <p id="demo"></p> <script> const myObj = { name: "adel", 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+DQpjb25zdCBteU9iaiA9IHsNCiAgbmFtZTogImFkZWwiLA0KICBhZ2U6IDMwLA0KICBjYXJzOiB7DQogIGNhcjE6ICJGb3JkIiwNCiAgY2FyMjogIkJNVyIsDQogIGNhcjM6ICJGaWF0Ig0KICB9DQp9DQoNCmxldCBwMSA9ICJjYXJzIjsNCmxldCBwMiA9ICJjYXIyIjsNCmRvY3VtZW50LmdldEVsZW1lbnRCeUlkKCJkZW1vIikuaW5uZXJIVE1MID0gbXlPYmpbcDFdW3AyXTsNCjwvc2NyaXB0Pg0KDQo8L2JvZHk+DQo8L2h0bWw+