How can I append a word to an already populated string variable with spaces?
4 Answers
var str1 = 'abc';
var str2 = str1+' def'; // str2 is now 'abc def'
3 Comments
Ronal
it's more of a onclick append to variable. can it be done with a single variable?
James Skidmore
Sure thing. See my other answer below.
karim79
@Ronal - if there are any extra bits to your question, you should add them to the question rather than asking within the comments, including any information that might help you get a decent answer.