Adding text to beginning of each array element

Example for ES6

var arr = ['first', 'second', 'third'];    
arr = arr.map(i => '#' + i);

Result:

console.log(arr); // ["#first", "#second", "#third"]

Leave a Comment