• function

pop can.Observe.List.prototype.pop

 

Remove an element from the end of a List.

list.pop()

push 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.Observe.List.push push]:

var list = new can.Observe.List(['Alice']);

list.push('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 [can.Observe.List.push push], or you may be looking for [can.Observe.List.unshift unshift] and its counterpart [can.Observe.List.shift shift].