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); });