Javascript Array map(command)
Array.prototype.map = function(command){ var outArray = []; this.each(function(x){ outArray.push(command(x));//from w w w. j a v a 2 s .co m }); return outArray; };