更新时间:2023-11-02 23:49:04
你已经过时了。您可以使用对象文字符号和括号表示法。
You are way over complicating this. You can just use object literal notation and bracket notation.
function getRegions(data) {
var result = {};
$.each(data, function (i, country) {
result[data[i].Country] = {
tooltip: 'Test',
attr: {
fill: data[i].Color
}
};
});
return result;
}