I am trying to make each word in an array have the same number of characters….so I add blank spaces to the end of the words so that each word in a ‘column’ has the same length.
Here is the code i have put together so far:
[code]
function padWord(aArray,tc){
var sFMTD=””;
for (c=0; c < tc; c++){
var mLen=0;
for (r=0; r < 11; r++){
if (aArray[r][c].length > mLen) mLen=aArray[r][c].length;
}
for (r=0; r < 11; r++){
if (aArray[r][c].length < mLen){
for (a=0; a < (mLen-aArray[r][c].length); a++){
aArray[r][c]+=” “;
}
}
}
}
for (r=0; r < 11; r++){
if (sFMTD!=””) sFMTD+=”n”;
for (c=0; c < tc; c++){
sFMTD+=aArray[r][c]+” “;
}
}
return sFMTD;
}
But, its not working right…any ideas?