Skip to content

Instantly share code, notes, and snippets.

@conanak99

conanak99/no_encap.js Secret

Created Jan 20, 2016
Embed
What would you like to do?
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
You can’t perform that action at this time.