Skip to content

Instantly share code, notes, and snippets.

@heapwolf
Created July 19, 2012 23:01
Show Gist options
  • Save heapwolf/3147467 to your computer and use it in GitHub Desktop.
Save heapwolf/3147467 to your computer and use it in GitHub Desktop.
modules/pi-obj
var pi = Math.PI;
module.exports = function(radius) {
function diameter() {
return2 * radius;
}
function circumference() {
return pi * diameter();
}
function area() {
return pi * Math.pow(radius, 2);
}
return {
area: area,
circumference: circumference
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment