Entfernen Sie das letzte Element aus Array JavaScript
array.splice(-1,1)
Innocent Iguana
array.splice(-1,1)
arr.splice(-1,1)
// OR
arr.splice(arr.length-1,1)
// OR
arr.pop()
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"];
array.pop();
array.pop();
// Example
var colors = ['Yellow', 'Red', 'Blue', 'Green'];
var removedColor = colors.pop(); // Green
console.log(colors); // ['Yellow', 'Red', 'Blue']