DoneJS StealJS jQuery ++ FuncUnit DocumentJS
3.0.0
2.3.27

 

  • Github
  • Twitter
  • Chat
  • Forum
  • prototype
    • concat
    • forEach
    • indexOf
    • join
    • pop
    • push
    • replace
    • reverse
    • shift
    • slice
    • splice
    • unshift
  • static
    • can.List.Map
  • Bitovi
    • Bitovi.com
    • Blog
    • Consulting
    • Training
    • Open Source
  • Chat
  • Forum
  • Star
  • Follow @canjs
  • can.List
  • /
  • pop
  • / On this page
    • pop

      function

      Remove an element from the end of a List.

      • source

      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.

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