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

Popular posts from this blog

yii2 - Yii 2 Running a Cron in the basic template -

asp.net - 'System.Web.HttpContext' does not contain a definition for 'GetOwinContext' Mystery -

mercurial graft feature, can it copy? -