I see answers like this for getting the biggest number in an array,
var arr = [1, 2, 3];
var max = Math.max(...arr);
But what about doing this for an array of objects, each of which have a number field, something like this
class test {
number: x
other_fields
}
var arr = [test1, test2, test3];
var max = Math.max(...arr);