Combining Strings
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 = "tomorrow\'s ";var word4 = "yesterday.";var sentence1 = word1 + word2 + word3 + word4;var sentence2 = word1.concat(word2, word3, word4);
Get Learning AngularJS now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.