Hello @kartik,
You can implement the Array.insert method by doing this:
Array.prototype.insert = function ( index, item ) {
this.splice( index, 0, item );
};
Then you can use it like:
var arr = [ 'A', 'B', 'D', 'E' ];
arr.insert(2, 'C');
// => arr == [ 'A', 'B', 'C', 'D', 'E' ]
Hope it helps!!
Thank you!!