map

The method executes the callback function for every single item in the array and returns a new array as a result. An equivalent of Array.prototype.map.

Parameters

callback Function

The function that will be executed for every item.

Returns

Array—A new array with the results from the executed callback.

Example - working with map method

 <script>
  var arr = 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}
  ]);     
  var newArr = arr.map(item => { return item.count*3})
  /* The result can be observed in the DevTools(F12) console of the browser. */
  console.log(arr)
  console.log(newArr)
</script>
In this article