Here inserting the element after shruthi
var arr = [];
arr[0] = "uday";
arr[1] = "shruthi";
arr[2] = "Riyansh";
arr[3] = "Rithika";
arr[4] = "Tagore";
console.log(arr.join()); // uday,shruthi,Riyansh,Rithika,Tagore
arr.splice(2, 0, "Rocky");
console.log(arr.join()); //
uday,shruthi,Rocky,Riyansh,Rithika,Tagore
Comments
Post a Comment