จาวาสคริปต์เพิ่มเข้าไปอาเรย์
var colors=["red","white"];
colors.push("blue");//append 'blue' to colors
จาวาสคริปต์กดดันที่จะเป็นอาเรย์
some_array = ["John", "Sally"];
some_array.push("Mike");
console.log(some_array); //output will be =>
["John", "Sally", "Mike"]
js ตารางคู่ลำดับเพิ่มธาตุ
array.push(element)
จาวาสคริปต์แทรกรายการเข้าไปในตารางคู่ลำดับ
var colors=["red","blue"];
var index=1;
//insert "white" at index 1
colors.splice(index, 0, "white"); //colors = ["red", "white", "blue"]
เพิ่มค่าที่จะตารางคู่ลำดับจาวาสคริปต์
var fruits = ["222", "vvvv", "eee", "eeee"];
fruits.push("Kiwi");
js เพิ่มธาตุที่อาเรย์
var fruits = [ "Orange", "Apple", "Mango"];
fruits.push("Banana");