Skip to content

Instantly share code, notes, and snippets.

@tobie
Created October 10, 2008 13:54
Show Gist options
  • Save tobie/16046 to your computer and use it in GitHub Desktop.
Save tobie/16046 to your computer and use it in GitHub Desktop.
function Point(x, y) {
function getX() {
return x;
}
function getY() {
return y;
}
function getOriginDistance() {
return Math.sqrt(getX()**2 + getY()**2);
}
return {
getX: getX,
getY: getY,
getOriginDistance: getOriginDistance
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment