这些javascript有什么问题

时间:2013-06-21 06:12:32

标签: javascript components

var Component = function (config) {
for (property in config) {
this[propety] = config[property]
}
}
var list = Array (
"Item 1",
"Item 2",
"Item 3");

var instance = Component(id: "XF-254", list: list);

它不起作用。

1 个答案:

答案 0 :(得分:1)

var Component = function (config) {
   for (var property in config) {
     this[propety] = config[property]
   }
}

var list = [
"Item 1",
"Item 2",
"Item 3"];

var instance = new Component({id: "XF-254", list: list});