I have the following object:
var questions = [{
'question_id': 245,
'question': 'Question 1',
'ordinal': 1,
'master_difficulty': 1,
'overridden_difficulty': ''
},{
'question_id': 34,
'question': 'Question 2',
'ordinal': 2,
'master_difficulty': 1,
'overridden_difficulty': ''
},{
'question_id': 656,
'question': 'Question 3',
'ordinal': 3,
'master_difficulty': 1,
'overridden_difficulty': ''
},{
'question_id': 86,
'question': 'Question 4',
'ordinal': 4,
'master_difficulty': 1,
'overridden_difficulty': ''
}]
And I want to get the highest ordinal value from it.
e.g. var highestOrdinal = highestOrdinalFunction(questions);
Where highestOrdinalFunction
will return the highest ordinal number.
So in this case it would return 4
.
Could Math.max
work for this?