Hapus elemen terakhir dari array javascript
array.splice(-1,1)
Innocent Iguana
array.splice(-1,1)
var colors = ["red","blue","green"];
colors.pop();
array.pop(); //returns popped element
//example
var fruits = ["Banana", "Orange", "Apple", "Mango"];
fruits.pop(); // fruits= ["Banana", "Orange", "Apple"];
arr.splice(arr.length - 2, 1);
var array = [1, 2, 3, 4, 5, 6];
array.pop();
console.log(array);
//Output in console section:
//[1, 2, 3, 4, 5]
array.splice(-1)