how to combine strings in javascript code example

Example 1: how to concatenate strings javascript

var str1 = "Hello ";
var str2 = "world!";
var res = str1.concat(str2);
// does not change the existing strings, but
// returns a new string containing the text
// of the joined strings.

Example 2: javascript string concatenation

var totn_string = '';

console.log(totn_string.concat('Tech','On','The','Net'));

//The following will be output to the web browser console log:

TechOnTheNet

Example 3: concat no and string in javascript

['Hello', ' ', 'World'].join(''); // 'Hello World'

Example 4: string concatenation js

var aString="";
aString.concat(value1, value2, ... value_n);

Example 5: string javascript concatenation

var dest = new String("");
    var src = new String("aze");
    ...
    dest += src + src + src + src + src;

Tags:

Rust Example