supprimer le dernier élément du tableau javascript
array.splice(-1,1)
Innocent Iguana
array.splice(-1,1)
Array.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();
var arr = [1,2,3,4];
console.log(arr.splice(0,arr.length-1));
Run code snippetHide results