var array = ["S", "V", "B"];
document.getElementById("div_p").innerHTML = array
var arrIDs=new Array();
arrIDs.push(e);
document.getElementById("div_p").innerHTML=arrIDs.join(',');
var arr = new Array(3);
arr[0] = "a";
arr[1] = "b";
arr[2] = "c";
var array1 = new Array("S", "V", "B");
//for object
var person = {firstName:"John", lastName:"Doe", age:46};
At position 2, add the new items, and remove 1 item:
var fruits = ["Banana", "Orange", "Apple", "Mango"];
fruits.splice(2, 1, "Lemon", "Kiwi");
The result of fruits will be:
Banana,Orange,Lemon,Kiwi,Mango
No comments:
Post a Comment