pop an element from list javascrpit code example
Example 1: js remove from array by value
const index = array.indexOf(item);
if (index !== -1) array.splice(index, 1);
Example 2: javascript remove last element from array
array.pop(); //returns popped element
//example
var fruits = ["Banana", "Orange", "Apple", "Mango"];
fruits.pop(); // fruits= ["Banana", "Orange", "Apple"];