Append to string variable [closed]

How can I append a word to an already populated string variable with spaces?

Answers:

Answer
var str1 = "add";
str1 = str1 + " ";

Hope that helps,

Dan

Answer

Ronal, to answer your question in the comment in my answer above:

function wasClicked(str)
{
  return str+' def';
}
Answer

Like this:

var str = 'blah blah blah';
str += ' blah';

str += ' ' + 'and some more blah';
Answer
var str1 = 'abc';
var str2 = str1+' def'; // str2 is now 'abc def'

Tags

Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.