You can combine multiple strings either by using a +
operation or by using the concat()
function on the first string. For example, in the following code, sentence1
and sentence2
will be the same:
var word1 = "Today ";
var word2 = "is ";
var word3 = "tomorrows' ";
var word4 = "yesterday.";
var sentence1 = word1 + word2 + word3 + word4;
var sentence2 = word1.concat(word2, word3, word4);