Nodejs Array Delete del(n)

Here you can find the source of del(n)

Method Source Code

Array.prototype.del=function(n) {
   if(n<0){//ww w. j a  v  a2s  .c  om
      return this;
   }else{
      return this.slice(0,n).concat(this.slice(n+1,this.length));
   }
}

Related

  1. del(index)
    Array.prototype.del = function(index){
        if(isNaN(index) || index > this.length || index < 0){
            return false;
        this.splice(index,1);
    
  2. deleteRepeat()
    Array.prototype.deleteRepeat = function(){
      var arr = this, 
        result=[], 
        flag; 
      for(var i=0;i<arr.length;i++){
        flag=true;
        for(var j=0;j<result.length;j++){
          if(result[j]===arr[i]){
            flag=false;
    ...
    
  3. deleteSame()
    function JsonSort(json,key){
        for(j=1;j < json.length;j++){
            var temp = json[j],
                val  = temp[key],
                i    = j-1;
            while(i >=0 && json[i][key]>val){
                json[i+1] = json[i];
                i = i-1;
            json[i+1] = temp;
        return json;
    Array.prototype.deleteSame = function(){
      var res = [this[0]];
      for(var i = 1; i < this.length; i++){
        var repeat = false;
        for(var j = 0; j < res.length; j++){
          if(this[i] == res[j]){
            repeat = true;
            break;
        if(!repeat){
          res.push(this[i]);
      return res;
    
  4. trim(deleteValue)
    Array.prototype.trim = function(deleteValue) {
      var i;
      for (i = 0; i < this.length && this[i] == deleteValue;) {
        this.splice(i, 1);
      for (i = this.length-1; i >= 0 && this[i] == deleteValue; --i) {
        this.splice(i, 1);
      return this;
    ...