array insertion javascript
Array.prototype.insert = function ( index, item ) {
this.splice( index, 0, item );
};
array insertion javascript
Array.prototype.insert = function ( index, item ) {
this.splice( index, 0, item );
};
add elements to an array with splice
var fruits = ["Banana", "Orange", "Apple", "Mango"];
document.getElementById("demo").innerHTML = fruits;
function myFunction() {
fruits.splice(2, 0, "Lemon", "Kiwi");
document.getElementById("demo").innerHTML = fruits;
}
javascript Inserting values in between an array
myArray.splice(index, itemsToDelete, item1ToAdd, item2ToAdd, ...)
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