The Universal Standard
Easy+15 XP
Mission Briefing
The bouncer at the club must verify that every single person in the group is old enough to enter! If even one person is underage, the entire group is denied.
The Concept: Does 'Every' Match?
The .every() method tests whether all elements in the array pass the provided test function. It returns a boolean.
Example: [10, 20, 30].every(x => x > 5); // true
The Objective
Your function receives an array ages.
- Use the
.every()method. - Return
trueif all ages are 18 or older, otherwisefalse.
01EXAMPLE 1
Input
ages = [20, 25, 30]Output
trueConstraints
- Use the .every() method.
CoreArrays
JavaScriptSystem handles I/O — write your function only
Loading...
3 Hidden
Input Arguments
ages[20,25,30]
Expected Output
true
Click RUN to test your solution