tobie (owner)

Revisions

gist: 16046 Download_button fork
public
Public Clone URL: git://gist.github.com/16046.git
Embed All Files: show embed
JavaScript #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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
  };
}