Skip to content

Instantly share code, notes, and snippets.

Created January 20, 2016 22:11
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';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment