js array element concat code example
Example 1: javascript append to array
var colors=["red","white"];
colors.push("blue");//append 'blue' to colors
Example 2: .join in javascript
const elements = ['Sun', 'Earth', 'Moon'];
console.log(elements.join());
// output: "Sun,Earth,Moon"
console.log(elements.join(''));
// output: "SunEarthMoon"
console.log(elements.join('-'));
// output: "Sun-Earth-Moon"