-
-
Save conanak99/22a1e75663e87b7fdd7c 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); | |
}; | |
} | |
var psn1 = new Person('Hoang', 'Pham'); | |
// các property khai báo vào biến this có thể bị truy xuất từ bên ngoài | |
// object không còn bao đóng nữa | |
psn1.firstName = 'changed'; | |
console.log(ps1.firstName); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment