Created
April 13, 2010 00:37
-
-
Save coolaj86/364174 to your computer and use it in GitHub Desktop.
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
| // Crockford's Prototypal Inheritance Example | |
| // Slide 53, Act III: Function the Ultimate | |
| // http://yuiblog.com/crockford | |
| // Parent | |
| var gizmo = new_constructor(Object, function (id) { | |
| this.id = id; | |
| }, { | |
| toString: function () { | |
| return "gizmo " + this.id; | |
| } | |
| }); | |
| // Child | |
| var hoozit= new_constructor(gizmo, function (id) { | |
| this.id = id; | |
| }, { | |
| test: function (id) { | |
| return this.id === id; | |
| } | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment