indexOf

Returns the index in the Array at which the item can be found. An equivalent of Array.prototype.indexOf.

Parameters

item String|Number|Object

The searched item.

Returns

Number—The index of the specified data item. Returns -1 if the data item is not found.

Example - working with indexOf method

<script>
  var array = new kendo.data.ObservableArray(["Apple", "Orange", "Berries", "Melon", "Grape", "Pear"])
  var result = array.indexOf("Grape");
  /* The result can be observed in the DevTools(F12) console of the browser. */
  console.log(result); // outputs "4"
</script>
In this article