How do I add a string to all existing elements in array in javascript? -
if have array such following
var = ["a","b","c","d"];
how can add onto string of each item using loop make result return so?
["i a", "i b", "i c", "i d"]
["a","b","c","d"].map(function(e) { return "i " + e });
or full code (thanks mplungjan!)
var = ["a","b","c","d"]; = a.map(function(e) { return "i " + e });
Comments
Post a Comment