Object.create
function object(o) { o = Object(o); function F() {} F.prototype = o; var obj = new F(); var methods = ["toString", "toLocaleString", "valueOf"]; for (var i = 0; i < methods.length; i++) with ({ method: methods[i] }) obj[method] = function () { return o[method].apply(o, arguments); }; return obj; } var myStr = object("子"); myStr.x = function (n) { var s = ""; while (n--) s += this; return s; }; alert(myStr.x(12));
机器瞎学/数据掩埋/模式混淆/人工智障/深度遗忘/神经掉线/计算机幻觉/专注单身二十五年