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 */ } );
const myArray = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
const maxValue = 4;
myArray.forEach((value) => {
if (value > maxValue) break;
console.log('Current value is ', value);
});