Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

node javascript foreach limit

const myArray = ['cat', 'dog', 'fish', 'turtle'];
// to select first 3 elements
myArray.slice(0, 3).forEach( arrayEntry => { /* first three entries */ } );
// you can do the same from the end of the array
myArray.slice(-2).forEach( arrayEntry => { /* last two entries */ } );
 
PREVIOUS NEXT
Tagged: #node #javascript #foreach #limit
ADD COMMENT
Topic
Name
5+5 =