Insert element to array at position - Node.js Array

Node.js examples for Array:Insert

Description

Insert element to array at position

Demo Code



Array.prototype.insertAt = function(index, item) {
  this.splice(index, 0, item);//from w w  w. jav a 2 s  .c  o m
  return this;
};

Related Tutorials