Created
July 2, 2017 06:56
-
-
Save mattn9x/7ce1206c02b7f621490ca9d44316b0af to your computer and use it in GitHub Desktop.
Khởi tạo đối tượng với prototype
This file contains hidden or 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 Student() {} | |
Student.prototype.firstName = "Manh"; Student.prototype.lastName = "Nguyen"; | |
Student.prototype.showName = function () { | |
console.log("I'm " + this.firstName + '- ' + this.lastName); | |
}; | |
var student = new Student(); | |
console.log('Test Protoype'); console.log(student.firstName);// Manhstudent.showName(); //I'm Manh- Nguyen |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment