pop

  • function
can.List.prototype.pop  

Remove an element from the end of a List.

list.pop()

pop removes an element from the end of a List.

Returns

{*}

the element just popped off the List, or undefined if the List was empty

pop is the opposite action from [can.List.push push]:

var list = new can.List(['Alice', 'Bob', 'Eve']);
list.attr(); // ['Alice', 'Bob', 'Eve']

list.pop(); // 'Eve'
list.pop(); // 'Bob'
list.pop(); // 'Alice'
list.pop(); // undefined

Events

pop causes change, remove, and length events to be fired if the List is not empty when it is called.

See also

pop has its counterpart in push, or you may be looking for unshift and its counterpart shift.