Javascript Array map(transformer)
Array.prototype.map = function(transformer) { var result = []/*from w w w . java 2 s . com*/ for ( var i = 0; i < this.length; i++) { result.push(transformer(this[i])); } return result; }