File tree Expand file tree Collapse file tree
javascript-prototypal-inheritance Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ # JavaScript Prototypal Inheritance
2+
3+ > [ http://youtu.be/qMO-LTOrJaE ] ( http://youtu.be/qMO-LTOrJaE )
4+
5+ Install [ io.js] ( https://iojs.org/en/index.html ) .
6+
7+ Within this folder run the terminal command ` npm install ` to install the
8+ ` devDependencies ` .
9+
10+ Then run ` npm start ` to start up a development server on ` http://localhost:9966 `
Original file line number Diff line number Diff line change 1+ function Bear ( type ) {
2+ this . type = type
3+ }
4+ Bear . prototype . growl = function ( ) {
5+ console . log ( 'The ' + this . type + ' bear says grrr' )
6+ }
7+
8+ function Grizzly ( ) {
9+ Bear . call ( this , 'grizzly' )
10+ }
11+ Grizzly . prototype = Object . create ( Bear . prototype )
12+ // Grizzly.prototype.growl = function() {
13+ // console.log('on the Grizzly.prototype')
14+ // }
15+
16+ //var grizzly = new Bear('grizzly')
17+
18+ var grizzly = new Grizzly ( )
19+ var polar = new Bear ( 'polar' )
20+
21+
22+ //grizzly.growl = function() { console.log('override') }
23+ console . log ( grizzly . growl ( ) )
Original file line number Diff line number Diff line change 1+ {
2+ "name" : " javascript-prototypal-inheritance" ,
3+ "version" : " 0.1.0" ,
4+ "description" : " " ,
5+ "main" : " index.js" ,
6+ "scripts" : {
7+ "start" : " budo index.js --live"
8+ },
9+ "author" : " Kyle Robinson Young <kyle@dontkry.com> (http://dontkry.com)" ,
10+ "license" : " MIT" ,
11+ "devDependencies" : {
12+ "budo" : " ^3.1.1" ,
13+ "watchify" : " ^3.1.2"
14+ }
15+ }
You can’t perform that action at this time.
0 commit comments