SHOW:
|
|
- or go back to the newest paste.
1 | function Person(firstname, lastname) { | |
2 | - | this.firstname = firstname; |
2 | + | |
3 | - | this.lastname = lastname; |
3 | + | var prototype = Object.getPrototypeOf(this); |
4 | prototype.firstname = firstname; | |
5 | - | if (!Person.prototype.getFullname) { |
5 | + | prototype.lastname = lastname; |
6 | - | Person.prototype.getFullname = function () { |
6 | + | |
7 | - | return this.firstname + ' ' + this.lastname; |
7 | + | |
8 | - | }; |
8 | + |