Nodejs Array Insert At insertAt( index, value )

Here you can find the source of insertAt( index, value )

Method Source Code

Array.prototype.insertAt = function( index, value ) {
   var part1 = this.slice( 0, index );
   var part2 = this.slice( index );
   part1.push( value );//www .j a  v a 2s  . co  m
   return( part1.concat( part2 ) );
};

Related

  1. insertAt(arg, position)
    Array.prototype.insertAt = function(arg, position){
        this.splice(position, 0, arg);
    };
    
  2. insertAt(index, item)
    Array.prototype.insertAt = function(index, item) {
      this.splice(index, 0, item);
      return this;
    };
    
  3. insertAt(index,obj)
    Array.prototype.insertAt=function(index,obj){
        this.splice(index,0,obj);
    
  4. insertAt(index,obj)
    Array.prototype.insertAt=function(index,obj){
      this.splice(index,0,obj);