Home
<!DOCTYPE html> <html> <body> <h1>Demo: JavaScript Nested Object</h1> <p id="p1"></p> <script> var person = { firstName: "James", lastName: "Bond", age: 25, address: { id: 1, country:"UK" } }; document.getElementById("p1").textContent = person.address.country; </script> </body> </html>
Result: