Method to wrap each element of this array returns array - Node.js Array

Node.js examples for Array:Array Value

Description

Method to wrap each element of this array returns array

Demo Code

Array.prototype.wrapEach = 
function wrapEach(prefix,suffix) 
{
  var ret = [ ];//from  ww w.java  2 s .c o m
  for (var i = 0; i < this.length; i++) {
    ret .push( prefix + this[i] + suffix );
  }
  return ret;
}

Related Tutorials