Home
<!DOCTYPE html> <html> <body> <h1>Demo: JavaScript Object</h1> <p id="p1"></p> <p id="p2"></p> <script> var person = { firstName : "John" }; var anotherPerson = person; anotherPerson.firstName = "Bill"; document.getElementById("p1").textContent = person.firstName; document.getElementById("p2").textContent = anotherPerson.firstName; </script> </body> </html>
Result: