удалить последний элемент из массива 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"];
array.pop();
// example (remove the last element in the array)
let yourArray = ["aaa", "bbb", "ccc", "ddd"];
yourArray.pop(); // yourArray = ["aaa", "bbb", "ccc"]
// syntax:
// <array-name>.pop();
var fruits = ["Banana", "Orange", "Apple", "Mango"];
document.write(fruits);
document.write("<br>");
fruits.pop();
document.write(fruits)