If you use the map()
method and as a result of executing a function with a template literal you have extra characters from the array (commas, brackets), then apply join()
method after map()
.
Like this:
let variable = array.map(el => {
// code with template literal
return result;
}).join('');