I need to sort some arrays inside an array.
For example:
let mainArr = [['john', 27, 'teacher'], ['Mary', 17, 'student'], ['Jane', 40, 'police']];
In this case I want to sort it by person's age, so the output would be:
let mainArrSorted = [['Mary', 17, 'student'], ['john', 27, 'teacher'], ['Jane', 40, 'police']];
Any sugestions?
NOTE: I don't want to implement array.sort() method.
Thank you in advance.