如果我有这样的for循环:
var rows;
var len = z[0].length;
for ( var i = len; i--; ) {
rows += "<tr><td>" + z[0].Marketer + "</td><td>";
}
如何在不添加for循环结构的情况下添加而不是将当前行附加到此字符串?
var rows;
var len = z[0].length;
for ( var i = len; i--; ) {
rows (prepend) "<tr><td>" + z[0].Marketer + "</td><td>";
}
答案 0 :(得分:24)
像这样:
rows = "<tr><td>" + z[0].Marketer + "</td><td>" + rows;