You're developing a function for
a school system that validates
a list of student objects based
on multiple criteria.
Your task is to create a function named validateStudents
that checks if
all students in an array meet
the following criteria:
- Name Validity: Every student must have a name property that is a non-empty string.
- Age Validity: Every student must have an age property that is an integer between 5 and 18 (inclusive).
- Grades Validity: Every student must have a grades property that is an array of numbers between 0 and 100 (inclusive), and this array must contain at least one grade (it can't be empty).
The validateStudents
function should return
true
if all students in the array meet
these criteria and false otherwise.
For example:
Log the output to the console.