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
//Bind an inner function to this, same this as outer function | |
//EloquentJS Ch8 | |
function bind(func, object) { | |
return function(){ | |
return func.apply(object, arguments); | |
}; | |
} | |
//Example | |
var testArray = []; |
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
//Simple Javascript Inheritance - John Resig | |
//example code | |
var Person = Class.extend({ | |
init: function(isDancing){ | |
this.dancing = isDancing; | |
}, | |
dance: function(){ | |
return this.dancing; | |
} | |
}); |
NewerOlder