Skip to content

Instantly share code, notes, and snippets.

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