new Function (intermediate value) notafunction?
function createNamedFunction(name, body) { return new Function("body", "return function " + name + "() {\n" + " \"use strict\";" + " return body.apply(this, arguments);\n" + "};\n")(body); }; var errorName = 'InternalError'; var errorClass = createNamedFunction(errorName, function (message) { this.name = errorName; this.message = message; }); 动态方法生成问题: 以上写法再小程序中会提示 TypeError: (intermediate value) is not a function