function construct( x, y ) { this.x = x; this.y = y; } construct.prototype.sum = function() { return this.x + this.y; } var obj = new construct( 1, 2 ); alert( [ obj.x, obj.y ].join( '\n' ) ); alert( obj.sum() );