Created
October 10, 2008 13:54
-
-
Save tobie/16046 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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