Tryit Editor v2.3

Edit This Code:
<!DOCTYPE html> <html> <body> <p>An object method is a function definition stored as a property value.</p> <p>If you access it without (), it will return the function definition:</p> <p id="demo"></p> <script> var person = { firstName: "John", lastName : "Doe", id : 5566, fullName : function() { return this.firstName + " " + this.lastName; } }; document.getElementById("demo").innerHTML = person.fullName; </script> </body> <!-- Mirrored from www.w3schools.com/js/tryit.asp?filename=tryjs_object_function by HTTrack Website Copier/3.x [XR&CO'2014], Fri, 23 Jan 2015 07:36:16 GMT --> </html>
Result:
Try it Yourself - © w3schools.com