Nodejs Array Remove remove( from, to)

Here you can find the source of remove( from, to)

Method Source Code

/**//w  w w.ja  v a 2  s. co m
    Removes a number of objects from the array
    @param from The first object to remove (int)
    @param to (Optional) The last object to remove (int)
*/
Array.prototype.remove = function( from, to)
{
  var rest = this.slice((to || from) + 1 || this.length);
  this.length = from < 0 ? this.length + from : from;
  return this.push.apply(this, rest);
};

Related

  1. remove( from, to )
    Array.prototype.remove = function( from, to ) {
      var rest = this.slice( ( to || from ) + 1 || this.length );
      this.length = from < 0 ? this.length + from : from;
      return this.push.apply( this, rest );
    };
    
  2. remove( from, to )
    Array.prototype.remove = function( from, to ) {
      if( typeof from == 'object' ) {
        var idx = this.indexOf( from );
        if( idx >= 0 ) return this.remove( idx );
        return this;
      else {
        var rest = this.slice((to || from) + 1 || this.length);
        this.length = from < 0 ? this.length + from : from;
    ...
    
  3. remove()
    Array.prototype.remove= function(){
        var what, a= arguments, L= a.length, ax;
        while(L && this.length){
            what= a[--L];
            while((ax= this.indexOf(what))!= -1){
                this.splice(ax, 1);
        return this;
    ...
    
  4. remove()
    Array.prototype.remove = function() {
        var what, a = arguments, L = a.length, ax;
        while (L && this.length) {
            what = a[--L];
            while ((ax = this.indexOf(what)) !== -1) {
                this.splice(ax, 1);
        return this;
    ...
    
  5. remove()
    Array.prototype.remove = function() {
        var what, a = arguments, L = a.length, ax;
        while (L && this.length) {
            what = a[--L];
            while ((ax = this.indexOf(what)) !== -1) {
                this.splice(ax, 1);
        return this;
    ...
    
  6. remove()
    Array.prototype.remove = function() {
      var what, a = arguments, L = a.length, ax;
      while (L && this.length) {
        what = a[--L];
        while ((ax = this.indexOf(what)) !== -1) {
          this.splice(ax, 1);
      return this;
    ...