Node.js examples for Array:Associate Array
Flatten array into string
// wrap each element by *prefix*,*suffix* params // join by *infix* param Array.prototype.flatten = function flatten(prefix,suffix,infix) { return this.wrapEach(prefix||"",suffix||"").join(infix||""); } Array.prototype.each =//w w w .j a v a 2 s .c o m function each(f) { var ret = [ ]; for (var i = 0; i < this.length; i++) ret.push( f.call( this[i], i ) ); return ret; }