how to combine two character variables js code example

Example 1: how to concatenate strings and variables in javascript

const helloName = name => `Hello ${name}!`

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: merge two strings with alternate characters javascript

var m = (a, b) => a.length ? [a[0], ...m(b, a.slice(1))] : b;
var string1 = "SCE ESG!";
var string2 = "ERTMSAE";
var mix = m(string1, string2);

console.log(mix.join(''));

Example 4: javascript join 2 variables into string

A = 'hello ';
B = 'world!';

// outputs "hello world!"
console.log(A + B);