forEach

The method executes the callback function for every single item in the array. An equivalent of Array.prototype.forEach.

Parameters

callback Function

The function that will be executed for every item.

Example - working with forEach method

<script>
  var array = new kendo.data.ObservableArray([
    { id: 10, name: 'Apple', count: 5},
    { id: 20, name: 'Orange', count: 10},
    { id: 30, name: 'Milk', count: 12},
    { id: 40, name: 'Juice', count: 7},
    { id: 50, name: 'Melon', count: 20}
  ]);     
  array.forEach((item) => { item.count = item.count*3})
  /* The result can be observed in the DevTools(F12) console of the browser. */
  console.log(array)
</script>
In this article