Javatpoint Logo
Javatpoint Logo

orderBy Filter

The orderBy filter facilitates you to sort an array.

By default, it sorts strings in alphabetical order and numbers in numerical order.

Syntax:

Parameter explanation:

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
Next TopicUppercase Filter




Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA