Javascript Array yield(mapFunction)
Array.prototype.yield = function(mapFunction) { var newArr = []//ww w . j a va 2 s .c o m for (var i = 0; i< this.length; i++) { newArr.push(mapFunction(this[i])); } return newArr; }