Advertisement
Felanpro

More on objects.

Jun 16th, 2016
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <body>
  2.        
  3.             <p id="demo"></p>
  4.            
  5.                 <script>
  6.                
  7.                     var person = {
  8.                    
  9.                         firstName: "John",
  10.                         lastName: "Carlsson",
  11.                         fullName : function() {return this.firstName + " " + this.lastName;}  
  12.                         /*.this means that take another member from the same object to the other member
  13.                         of the same object.*/                  
  14.                          
  15.                     };
  16.                    
  17.                     document.getElementById("demo").innerHTML = person.fullName();
  18.                    
  19.                 </script>
  20.        
  21.         </body>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement