Edit This Code:
See Result »
<!DOCTYPE html> <html> <body> <p> There are two different ways to access an object property: </p> <p>You can use person.property or person["property"].</p> <p id="demo"></p> <script> var person = { firstName: "John", lastName : "Doe", id : 5566 }; document.getElementById("demo").innerHTML = person.firstName + " " + person.lastName; </script> </body> </html>
Result: