Skip to content

Instantly share code, notes, and snippets.

@Coconuthack
Coconuthack / gist:5464200
Created April 26, 2013 00:02
eloquentjs ch 8 bind function
//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 = [];
@Coconuthack
Coconuthack / gist:5245942
Created March 26, 2013 14:50
JavaScript: Inheritance John Resig
//Simple Javascript Inheritance - John Resig
//example code
var Person = Class.extend({
init: function(isDancing){
this.dancing = isDancing;
},
dance: function(){
return this.dancing;
}
});