Skip to content

Instantly share code, notes, and snippets.

@Maciek416
Created January 17, 2012 16:18
Show Gist options
  • Save Maciek416/1627299 to your computer and use it in GitHub Desktop.
Save Maciek416/1627299 to your computer and use it in GitHub Desktop.
//
// Crockford prototype-less style
//
var Circle = function(r){
return {
getRadius: function(){
return r;
},
setRadius: function(newR){
r = newR;
}
};
};
var c = Circle(5);
console.log(c.getRadius());
var c2 = Circle(7);
c2.setRadius(c.getRadius());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment