我有以下代码:
var self = this;
var test = function (name, properties) {
self[name] = {
prop1: "test1",
prop2: "test2"
};
// some code here assigning properties object to self[name] object
};
test("myObj", { "prop3": "test3", "prop4": "test4" });
我需要完成的是将properties
对象的内容分配给,myObj
以便最终:
self["myObj"] = {
prop1: "test1",
prop2: "test2",
prop3: "test3",
prop4: "test3"
};