Skip to content

Instantly share code, notes, and snippets.

@aaronpowell
Created August 1, 2011 02:41
Show Gist options
  • Select an option

  • Save aaronpowell/1117490 to your computer and use it in GitHub Desktop.

Select an option

Save aaronpowell/1117490 to your computer and use it in GitHub Desktop.
Q4 - Who's the owner?
function Person(name, age) {
this.name = name;
this.age = age;
};
function Employee(name, age, company, jobTitle) {
Person.call(this, company, jobTitle);
this.company = company;
this.jobTitle = jobTitle;
}
Employee.prototype = new Person();
var alex = new Employee("Alex", 30, 'Readify', 'Senior Consultant');
for (var propertyName in alex) {
if (alex.hasOwnProperty(propertyName)) {
console.log(propertyName + ': ' + alex[propertyName]);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment