js concat string variable 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: how to concatenate strings and variables in javascript
const helloName = name => `Hello ${name}!`
Example 3: concantene number in js
Use "" + 5 + 6 to force it to strings.
This works with numerical variables too:
var a = 5;
var b = 6;
console.log("" + a + b);