Skip to content

Instantly share code, notes, and snippets.

@debugmodedotnet
Created March 2, 2015 03:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save debugmodedotnet/95b4940cda009bbbccdb to your computer and use it in GitHub Desktop.
Save debugmodedotnet/95b4940cda009bbbccdb to your computer and use it in GitHub Desktop.
function Student(name, age) {
this.name = name;
this.age = age;
return this;
}
function ScienceStudent(name, age) {
Student.call(this, name, age);
this.subject = "Physics";
}
ScienceStudent.prototype = Object.create(Student.prototype);
var stud1 = new ScienceStudent('DJ', 32);
console.log(stud1.name + stud1.subject);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment