Run ❯
Get your
own
website
❯
Run Code
Ctrl+Alt+R
Save Code
Ctrl+Alt+A
Change Orientation
Ctrl+Alt+O
Change Theme
Ctrl+Alt+D
Go to Spaces
Ctrl+Alt+P
<!DOCTYPE html> <html> <body> <h1>JavaScript Objects</h1> <h2>Objects are Mutable</h2> <p>Changes to a copy of an object will also change the original object:</p> <p id="demo"></p> <script> // Create an Object const person = { firstName: "John", lastName: "Doe", age:50, eyeColor: "blue" }; // Try to create a Copy const x = person; // This will change age in person !!! x.age = 10; document.getElementById("demo").innerHTML = person.firstName + " is " + person.age + " years old."; </script> </body> </html>