Created
August 1, 2011 02:41
-
-
Save aaronpowell/1117490 to your computer and use it in GitHub Desktop.
Q4 - Who's the owner?
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 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