Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function Person(first, last) {
- this.firstName = first;
- this.lastName = last;
- this.fullName = function() {
- return this.firstName + " " + this.lastName;
- };
- };
- const person1 = new Person("Will", "Smith");
- const person2 = new Person("Ryan", "Gosling");
- console.log(person1.fullName()); // Will Smith
- console.log(person2.fullName()); // Ryan Gosling
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement