javascript push in specific index
arr.splice(index, 0, item);
//explanation:
inserts "item" at the specified "index",
deleting 0 other items before it
javascript push in specific index
arr.splice(index, 0, item);
//explanation:
inserts "item" at the specified "index",
deleting 0 other items before it
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"]
js add
//HOW TO ADD:
var num1 = 4;
var num2 = 6;
var answer = 4 + 6; //You can do num1 + num2 here!
function add(num1, num2) {
return num1 + num2;
};
console.log("4 + 6 is: " + add());
console.log("I hope this helped!");
js insert
arr.splice(index, 0, item);
// will insert item into arr at the specified index
// (deleting 0 items first, that is, it's just an insert).
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us