Array
id Name Age Language
1 Novel 16 90
2 Xiaomeng 18 93
2 Kitten 17 92
Question:
This is a table.
1: How to sort by age from smallest to largest?
2: How to sort by Chinese language from smallest to largest?
3: ID sorting is the default, so don’t use it╮( ̄▽ ̄"")╭
Simply put, the associative array is sorted by a certain key.
arr.sort((a, b)=> { return a.age - b.age })
Other similar
Learn about this function: array_multisort()