Input: The Array of the strings
var arr = ['a','b','c'];
var prefix = 'prefix_';
Output: Each element in the array should be prefixed by 'prefix':
['prefix_a','prefix_b','prefix_c']
Input: The Array of the strings
var arr = ['a','b','c'];
var prefix = 'prefix_';
Output: Each element in the array should be prefixed by 'prefix':
['prefix_a','prefix_b','prefix_c']
A simpler, ES6 way using Array#map :
const prefixArray = (array, prefix) => array.map(e => prefix+e);
Demo:
let arr = ['a','b','c'];
const prefix = 'prefix_';
const prefixArray = (array, prefix) => array.map(e => prefix+e);
console.log(prefixArray(arr,prefix));