i have function:
function getFieldNames(arrayOfRecords) {
var theStuff;
for (var i = 0; i = arrayOfRecords.length - 1; i++){
theStuff = arrayOfRecords[i];
theList = theStuff.split('" ');
for (var j = 0; j = theList.length - 1; j++) {
var v = theList[j].split('="');
fName1[i][j] = v[0];
}
}
return fName1;
}
the argument arrayOfRecords is an array, and i dont know how to setup to the ‘theStuff’ variable an array element? When I do like it is above, i get something stupid.
can anyone help me? 🙂
There may be other problems but the one that leaps out at me is your
forloop header:The second part should be a condition, which when evaluated to
falsewill stop the loop from running. What you probably wanted was:So when
iis not less thanarrayOfRecords.length, the loop will stop. Alternatively (to keep the- 1, but I tend to use the above version):The same goes for the nested loop.