DoneJS StealJS jQuery ++ FuncUnit DocumentJS
3.0.0
2.3.27

 

  • Github
  • Twitter
  • Chat
  • Forum
  • Guides
  • Core
    • can-component
    • can-compute
    • can-connect
    • can-define
    • can-define/list/list
      • events
        • add
        • length
        • propertyName
        • remove
      • prototype
        • concat
        • filter
        • forEach
        • get
        • indexOf
        • join
        • map
        • on
        • pop
        • push
        • replace
        • reverse
        • serialize
        • set
        • shift
        • slice
        • sort
        • splice
        • unshift
        • *
        • #
      • static
        • extend
    • can-define/map/map
    • can-route
    • can-route-pushstate
    • can-set
    • can-stache
    • can-stache/helpers/route
    • can-stache-bindings
  • Ecosystem
  • Infrastructure
  • Legacy
  • Bitovi
    • Bitovi.com
    • Blog
    • Consulting
    • Training
    • Open Source
  • Chat
  • Forum
  • Star
  • Follow @canjs
  • CanJS
  • /
  • Core
  • /
  • can-define/list/list
  • /
  • shift
  • / On this page
    • shift

      function

      Remove an item from the front of a list.

      • source

      list.shift()

      shift removes an element from the beginning of a DefineList.

      var list = new DefineList(['Alice','Adam']);
      list.shift(); //-> 'Alice'
      list.shift(); //-> 'Adam'
      list.shift(); //-> undefined
      

      Returns

      {*}:

      The element just shifted off the DefineList, or undefined if the DefineList is empty

      Use

      shift is the opposite action from unshift:

      Events

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

      See also

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

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