var params = ["hoge", "fuga", "aaa"];
Class = function () {};
Class.reflection = function (classname, params) {
var args = [];
for(var i=0; i < params.length; i++) args.push("params[%d]");
return eval("new " + classname + "(" + args.join(",").replace(/%d/g, (function () {
var i=0; return function () { return i++; };
})()) + ")");
}
var a = Class.reflection("Array", params);
document.write(a.join(","));
More than 5 years have passed since last update.
Register as a new user and use Qiita more conveniently
- You get articles that match your needs
- You can efficiently read back useful information
- You can use dark theme