秘密を持った点
/* PointWithSecret.js */ var Point = function (x, y, secret_) { this.x = x; this.y = y; var secret = (secret_ || "confidence"); this.getSecret = function() { return secret; }; }; Point.prototype = { moveTo : function (x, y) { this.x = x; this.y = y; }, toString : function () { return "(" + this.x + ", " + this.y + ")"; } };