[英]How to prepend a string to a string variable in a for loop without changing the loop structure?
If i have a for loop like this: 如果我有这样的for循环:
var rows;
var len = z[0].length;
for ( var i = len; i--; ) {
rows += "<tr><td>" + z[0].Marketer + "</td><td>";
}
How can i prepend instead of append the current row to this string WithOUT changing the for loop structure? 如何在不添加for循环结构的情况下将prepend附加到此字符串而不是将当前行追加?
var rows;
var len = z[0].length;
for ( var i = len; i--; ) {
rows (prepend) "<tr><td>" + z[0].Marketer + "</td><td>";
}
像这样:
rows = "<tr><td>" + z[0].Marketer + "</td><td>" + rows;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.