I am fetching some values in a forEach clause
data.forEach(function(content){
...
controller.setAttribute(value from data);
...}
This works for me. But data loop iterates for close to 20 times. And my controller can take only 5 values. Hence my controller in above example is taking last five values.
How can I limit my data to exit after reading first five values. I need to be having some counter there right?
Or is there any other way for controller to read only first five?
You can pass an index argument after the value argument and use that: