process.stdin.resume();
process.stdin.setEncoding('utf8');
// your code goes here
var console = {
log: function(s) {
process.stdout.write(s+"\n");
},
};
function Foo() {
this.readOnly = false;
Object.defineProperty(this, "disabled", {
get: function () { return !this.readOnly; },
enumerable: true,
});
}
Foo.prototype.report = function (s) {
console.log(s);
for (var i in this) {
if (typeof this[i] === "function")
continue;
console.log("\t" + i + " = " + this[i]);
}
}
var xxx = new Foo();
xxx.report("before:");
xxx.readOnly = true;
xxx.report("after:");
xxx.disabled = true;
xxx.report("disabled = true; ... ?");
cHJvY2Vzcy5zdGRpbi5yZXN1bWUoKTsKcHJvY2Vzcy5zdGRpbi5zZXRFbmNvZGluZygndXRmOCcpOwoKLy8geW91ciBjb2RlIGdvZXMgaGVyZQoKdmFyIGNvbnNvbGUgPSB7Cglsb2c6IGZ1bmN0aW9uKHMpIHsKCQlwcm9jZXNzLnN0ZG91dC53cml0ZShzKyJcbiIpOwoJfSwKfTsKCmZ1bmN0aW9uIEZvbygpIHsKCXRoaXMucmVhZE9ubHkgPSBmYWxzZTsKCU9iamVjdC5kZWZpbmVQcm9wZXJ0eSh0aGlzLCAiZGlzYWJsZWQiLCB7CgkJZ2V0OiBmdW5jdGlvbiAoKSB7IHJldHVybiAhdGhpcy5yZWFkT25seTsgfSwKCQllbnVtZXJhYmxlOiB0cnVlLAoJfSk7Cn0KCkZvby5wcm90b3R5cGUucmVwb3J0ID0gZnVuY3Rpb24gKHMpIHsKCWNvbnNvbGUubG9nKHMpOwoJZm9yICh2YXIgaSBpbiB0aGlzKSB7CgkJaWYgKHR5cGVvZiB0aGlzW2ldID09PSAiZnVuY3Rpb24iKQoJCQljb250aW51ZTsKCQljb25zb2xlLmxvZygiXHQiICsgaSArICIgPSAiICsgdGhpc1tpXSk7Cgl9Cn0KCnZhciB4eHggPSBuZXcgRm9vKCk7Cgp4eHgucmVwb3J0KCJiZWZvcmU6Iik7Cnh4eC5yZWFkT25seSA9IHRydWU7Cnh4eC5yZXBvcnQoImFmdGVyOiIpOwoKeHh4LmRpc2FibGVkID0gdHJ1ZTsKeHh4LnJlcG9ydCgiZGlzYWJsZWQgPSB0cnVlOyAuLi4gPyIpOwoK