Answers for "insert element at a position js"

5

insert element at a position js

var arr = [];
arr[0] = "Jani";
arr[1] = "Hege";
arr[2] = "Stale";
arr[3] = "Kai Jim";
arr[4] = "Borge";

console.log(arr.join()); // Jani,Hege,Stale,Kai Jim,Borge
arr.splice(2, 0, "Lene");
console.log(arr.join()); // Jani,Hege,Lene,Stale,Kai Jim,Borge
Posted by: Guest on April-22-2021

Code answers related to "insert element at a position js"

Code answers related to "Javascript"

Browse Popular Code Answers by Language