shift
Removes the first item from an ObvservableArray
and returns that item. An equivalent of Array.prototype.shift.
The
shift
method raises thechange
event. Theaction
field of the event argument is set to"remove"
. Theitems
field of the event argument is an array that contains the removed item.
Returns
Object
—The item which was removed.
Example - remove the first item
<script>
var array = new kendo.data.ObservableArray([1, 2, 3]);
var removed = array.shift();
/* The result can be observed in the DevTools(F12) console of the browser. */
console.log(removed); // outputs "1"
/* The result can be observed in the DevTools(F12) console of the browser. */
console.log(array.length); // outputs "2"
</script>