【发布时间】:2017-08-01 12:13:29
【问题描述】:
在下面function为什么“i”参数increment?
function colWidths(rows) {
return rows[0].map(function(_, i) {
return rows.reduce(function(max, row) {
return Math.max(max, row[i].minWidth());
}, 0);
});
}
【问题讨论】:
-
因为
map将其传递给回调函数并可以将其设为任何想要的值...!?
标签: javascript function higher-order-functions