Advertisement
Guest User

Untitled

a guest
Jun 18th, 2019
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. function Person(first, last) {
  2. this.firstName = first;
  3. this.lastName = last;
  4. this.fullName = function() {
  5. return this.firstName + " " + this.lastName;
  6. };
  7. };
  8.  
  9. const person1 = new Person("Will", "Smith");
  10. const person2 = new Person("Ryan", "Gosling");
  11.  
  12. console.log(person1.fullName()); // Will Smith
  13. console.log(person2.fullName()); // Ryan Gosling
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement