【Javascript】Objects / Can this get only one result?
Hi guys. I am a Javascript beginner and having a difficulty understanding Objects. I was practicing this below and just wondered why only one result can be shown. The result that is shown on my browser is only the fullName one. document.getElementById("test").innerHTML = person["firstName"]; document.getElementById("test").innerHTML = person.firstName; document.getElementById("test").innerHTML = person.fullName(); The reason why I typed these similar document tags above was just to understand what kind of ways exist and to figure out which is the easiest one for me. I would appreciate it if someone can help me on this. Here is the complete tags I made. <p id="test"></p> <script> var person = { firstName:"Michael", lastName:"Smith", age:26, fullName:function() { return this.firstName + " " + this.lastName; } }; document.getElementById("test").innerHTML = person["firstName"]; document.getElementById("test").innerHTML = person.firstName; document.getElementById("test").innerHTML = person.fullName(); </script> Thanks.