DoneJS StealJS jQuery ++ FuncUnit DocumentJS
3.0.0
2.3.27

 

  • Github
  • Twitter
  • Chat
  • Forum
  • Guides
  • Core
  • Ecosystem
  • Infrastructure
  • Legacy
    • can-ejs
    • can-list
      • Prototype
        • attr
        • each
        • filter
        • map
        • reverse
        • splice
      • Static
        • Map
        • extend
    • can-map
    • can-map-backup
    • can-map-define
    • can-view-href
  • Bitovi
    • Bitovi.com
    • Blog
    • Consulting
    • Training
    • Open Source
  • Chat
  • Forum
  • Star
  • Follow @canjs
  • CanJS
  • /
  • Legacy
  • /
  • can-list
  • /
  • reverse
  • / On this page
    • reverse

      function

      Reverse the order of a List.

      • source

      list.reverse()

      reverse reverses the elements of the List in place.

      Returns

      {can-list}:

      the List, for chaining

      var list = new 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

      CanJS is part of DoneJS. Created and maintained by the core DoneJS team and Bitovi. Currently 3.0.0.