Node.js examples for Data Structure:Map
Convert Array to Map
Array.prototype.Map = function(func) { var mappedArray = new Array(this.length); var i;/*from ww w . j a va2 s . co m*/ for (i = 0; i < this.length; i++) { mappedArray[i] = func(this[i]); } return mappedArray; }