cara mendorong item dalam array di javascript
let items = [1, 2, 3]
items.push(4); // items = [1, 2, 3, 4]
Dev Loop
let items = [1, 2, 3]
items.push(4); // items = [1, 2, 3, 4]
// push append the element at the end of the array
array = [1,2,3]
array.push(4) // [1,2,3,4]
// pop will remove the element from the end of the array.
array.pop() // [1,2,3]
array = [1,2,3]
array.push(2) // [1,2,3,4]
// pop will remove the element from the end of the array.
array.pop()
array = [1,2,3]
array.push(1) // [1,2,3,4]
// pop will remove the element from the end of the array.
array.pop()