reverse

  • function
can.List.prototype.reverse  

Reverse the order of a List.

list.reverse()

reverse reverses the elements of the List in place.

Returns

{can.List}

the List, for chaining

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

reversedList.attr(); // ['Eve', 'Bob', 'Alice'];
list === reversedList; // true

reverse calls replace internally and triggers corresponding add, remove, change and length events respectively.

Demo