Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Append to string variable [closed]

People also ask

How do you add to a string variable?

In JavaScript, we can assign strings to a variable and use concatenation to combine the variable to another string. To concatenate a string, you add a plus sign+ between the strings or string variables you want to connect. let myPet = 'seahorse'; console.

How do you append a variable in Python?

First, the list is defined and assigned to a variable. Then, using this variable we call the append() method, passing the element that we want to append (the string "B" ) as argument.


Like this:

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

str += ' ' + 'and some more blah';

var str1 = 'abc';
var str2 = str1+' def'; // str2 is now 'abc def'

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

Hope that helps,

Dan


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

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