I wrote aproximatley this code today:
function Point () { // 1
var x, y; // 2
// 3
this.setXY = function (x, y) { // 4
x = x; // 5 doesn't work
y = y; // 6 doesn't work
} // 7
} // 8
I want to make setXY
API look nice so I want to use x
and y
on line 4. However I also want to have my code internally nice, so I use x
and y
on line 2 for private variables.
Question I have is: Is is possible to have x
and y
everywhere in my code, both for private variables and function arguments? How would I assign x
to x
and y
to y
on line 5 and 6 so that it works?