pop with name in array code example
Example 1: js remove from array by value
const index = array.indexOf(item);
if (index !== -1) array.splice(index, 1);
Example 2: js array pop
var array = ['A', 'B', 'C'];
// removes and returns last element
lastElement = array.pop();