I use javascript to get a string (name) that I will eventually paste to a text file with other data (a grade).
var name = "Joe Smith";
var n = str.length;
document.getElementById("sum").value="" + name + " " + grade
I want to create a column effect that will make the text file easier to read by reading the length of the name string then adding a number of spaces relative to the length of the str variable.
So, if the string length is 15 spaces, I will add 5 spaces to make it 20. And if the string length is 10, I will add 10 spaces to make it 20 too. When I use the PRE tag, all the grade variables should line up.
Should I use the join() function somehow? I'm not sure how. Any suggestions?