Skip to content

Instantly share code, notes, and snippets.


conanak99/constructor.js Secret

Last active Jan 13, 2016
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);
// 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