-
-
Save conanak99/88d3a013234cbef16439 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(firstName, lastName) { | |
this.firstName = firstName; | |
this.lastName = lastName; | |
this.showName = function() { | |
console.log(this.firstName + ' ' + this.lastName); | |
}; | |
} | |
// Khi muốn tạo object person chỉ cần gọi constructor | |
var psn1 = new Person('Hoang', 'Pham'); | |
var psn2 = new Person('Hoang', 'Nguyen'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment