slice

Returns a single-level deep copy of a portion of an array. An equivalent of Array.prototype.slice. The result of the slice method is not an instance of ObvservableArray—it is a regular JavaScript Array object.

The slice method does not modify the original ObservableArray.

Parameters

begin Number

A zero-based index at which the extraction will start.

end Number

A zero-based index at which the extraction will end. If end is omitted, slice extracts to the end of the sequence.

Example - slice items from an ObservableArray

<script>
var array = new kendo.data.ObservableArray([1, 2, 3]);
var firstAndSecond = array.slice(0, 2);
/* The result can be observed in the DevTools(F12) console of the browser. */
console.log(firstAndSecond); // outputs [1, 2]
</script>
In this article