Node.js examples for Object:Class Definition
Point class with toString()
function Point(x,y){ this.x = x;// w ww .ja va 2 s. c om this.y = y; } Point.prototype.toString = function () { return '(' + this.x + ', ' + this.y + ')'; } var point = new Point(6,3); console.log(point.toString());//(6,3)