Created
May 24, 2013 19:08
-
-
Save bittersweetryan/5645817 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
var Widget = function(){ | |
this.messages = []; | |
}; | |
Widget.prototype.type='Widget'; | |
var SubWidget = function( name ){ | |
this.name = name; | |
}; | |
SubWidget.prototype = new Widget(); |
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
var sub1 = new SubWidget( 'foo' ); | |
var sub2 = new SubWidget( 'bar' ); | |
sub1.messages.push( 'foo' ); | |
sub2.messages.push( 'bar' ); |
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
var Widget = function(){ | |
this.messages = []; | |
}; | |
Widget.prototype.type='Widget'; | |
var SubWidget = function( name ){ | |
this.name = name; | |
Widget.apply( this, Array.prototype.slice.call(this) ); | |
}; | |
SubWidget.prototype = new Widget(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment