function sample(){ var x2,y2; var p = new point(); p.move(200,200); x2=p.x; y2=p.y; alert(x2); } function point(){ this.x = 50; this.y = 50; return this; } point.prototype.move = function( x1,y1 ){ this.x = this.x+x1; this.y = this.y+y1; }