The orderBy filter facilitates you to sort an array.
By default, it sorts strings in alphabetical order and numbers in numerical order.
expression: It is used to determine the order. It can be a string, function or an array.
reverse: It is optional. It is set to true if you want to reverse the order of the array.
Example1: (Simple orderBy example: By default case)Test it Now
Let's take an example, containing record of customers along with name and city.
Example2: (orderBy on the basis of name)Test it Now
Example3: (orderBy on the basis of city)Test it Now