I want to compare values from objects that I keep in an array.
I know that I can create new arrays with values from each object but I'm trying to find some way to do it without creating them.
Consider we have such situation:
soldiers[first, second, third]
first{name: John, shooting: 95, combat: 50, tactic: 88}
second{name: Arnold, shooting: 97, combat: 72, tactic: 68}
third{name: William, shooting: 87, combat: 86, tactic: 97}
I'd like to select the best soldier from the provided above - but I can't create one rating (i.e. average).
There will be some conditions that soldier must fill - for example: at least 60 points in combat (no matter if every other property is 100).
So I'm trying to find way to compare multiple properties and return name of just one soldier.
I'll appreciate every tip. Thanks!