iterable to iterate over (Array, Set, Map, etc.)
function to test each value
true if all values pass the check, false otherwise
const numbers = [2, 4, 6, 8, 10];
const allEven = allItemsValid(numbers, (num) => num % 2 === 0); // true
const mixed = [2, 4, 5, 8];
const allEven2 = allItemsValid(mixed, (num) => num % 2 === 0); // false (stops at 5)
Performs a for-of loop that breaks when the check function returns false.
Iterates over iterable values (arrays, Sets, Maps) and stops early if the check function returns false for any value.