Answers for "nodejs insert to array"

20

javascript insert item into array

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
0

nodejs add to array

var colors=["red","white"];
colors.push("blue");//append 'blue' to colors
Posted by: Guest on February-23-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language