concatenate javascirpt and html code example
Example 1: javascript concat
let chocholates = ['Mars', 'BarOne', 'Tex'];
let chips = ['Doritos', 'Lays', 'Simba'];
let sweets = ['JellyTots'];
let snacks = [];
snacks.concat(chocholates);
snacks.concat(chocolates, chips, sweets);
Example 2: js concatenate strings
const str1 = 'Hello';
const str2 = 'World';
console.log(str1 + str2);
>> HelloWorld
console.log(str1 + ' ' + str2);
>> Hello World
Example 3: string concatenation js
var aString="";
aString.concat(value1, value2, ... value_n);
Example 4: string concat in js
let string1 = "Hello"
let string2 = "World"
let finalString = string1 + ", " + string2 + "!"