-
-
Save conanak99/3e4fa5457fdb606932a5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Person() {} | |
Person.prototype.firstName = 'Hoang'; | |
Person.prototype.lastName = 'Pham'; | |
Person.prototype.showName = function() { | |
console.log(this.firstName + ' ' + this.lastName); | |
}; | |
// Object được tạo sẽ có sẵn các trường firstName, lastName | |
// và hàm showName | |
var psn1 = new Person(); | |
console.log(psn1.firstName); //Hoang | |
psn1.showName; //Hoang Pham |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment