Applies function to all pairs containing given index in array - Node.js Array

Node.js examples for Array:Array Value

Description

Applies function to all pairs containing given index in array

Demo Code


/* Applies function to all pairs containing given index */
Array.prototype.eachOther = function(i, func){
  for(var j=0; j < this.length; j++){
    if(j!=i) func.call(this, j);
  }/* w  w w. j  a  v a 2  s. com*/
}

Related Tutorials