Answers for "insert into specific array index that has a value existing on that index"

21

insert into specific array index that has a value existing on that index

var colors=["red","blue"];
var index=1;

//insert "white" at index 1
colors.splice(index, 0, "white");   //colors =  ["red", "white", "blue"]
Posted by: Guest on July-22-2019

Code answers related to "insert into specific array index that has a value existing on that index"

Code answers related to "Javascript"

Browse Popular Code Answers by Language