How can I add a string to a string variable in a for loop without changing the structure of the loop?

If I have a for loop like this:

var rows;
var len = z[0].length;
for ( var i = len; i--; ) {
     rows += "<tr><td>" + z[0].Marketer + "</td><td>";
 }

      

How can I add this line instead of the current line without changing the loop structure?

var rows;
var len = z[0].length;
for ( var i = len; i--; ) {
     rows (prepend) "<tr><td>" + z[0].Marketer + "</td><td>";
 }

      

+3


source to share


1 answer


Like this:



rows = "<tr><td>" + z[0].Marketer + "</td><td>" + rows;

      

+23


source







All Articles