this is my first question here so I'll try to be precise as much as possible.
I have homework which requires me to create an array of 5 objects which are students with their name, surname and average grade.
The average grade being set as any number from 2
to 5
for example: 2.50
, 3.34
, 4.95
etc. My only job here is to print out into the console the name
and surname
of the student with the lowest average grade.
For the life of me I couldn't figure out how to do it and googling didn't help or at least I didn't know how to look for it.
I could only define the objects but I don't know how to list through the objects and find the lowest 'avgGrade'.
var students = [
{ name: "John", surname: "Doe", avgGrade: 5.0 },
{ name: "Mike", surname: "Adams", avgGrade: 4.2 },
{ name: "Mark", surname: "Davis", avgGrade: 2.1 },
{ name: "Jane", surname: "Jones", avgGrade: 3.99 },
{ name: "Sarah", surname: "Quinn", avgGrade: 2.8 },
];