Javascript Array without(index)

Description

Javascript Array without(index)

Array.prototype.without = function(index){
  // or learn to understand SLICE?!
  var part1 = index > 0 ? this.slice(0,index) : []
  var part2 = this.slice(index+1)
  return part1.concat(part2);
};

Javascript Array without(index)

Array.prototype.without = function(index){
  // or learn to understand SLICE?!
  var part1 = index > 0 ? this.slice(0,index) : [];
  var part2 = this.slice(index+1);
  return part1.concat(part2);
};



PreviousNext

Related