Sorting an object by more than one value [duplicate]

I have a JSON file, that want to interrogate and return values.

On load the HTML page is populated with all the names.

persons = [
   {nationality: "GB",  code: 1004, initial: "J", surname: "Smith"},
   {nationality: "DEN", code: 1002, initial: "J", surname: "Smith"},
   {nationality: "GB",  code: 1003, initial: "A", surname: "Jones"},
   {nationality:" BEL", code: 1000, initial: "C", surname: "Down"}
];
    

This is how I have set it out so far:

As the user types in a surname in the Input box on each keyup it would query the filter the results from the data-attributes in the following way.

  1. surname > 2. initial > 3. nationality > 4. code.

So if a user starts to type in “Smith” the following result would appear in this order:

DEN. 1002, J. Smith. – would come first as the country name D is before E;
GB. 1004, J. Smith

The hierarchy of the filter would be:

Nationality (alphabetical order) > Surname (alphabetical Order) > Initial (alphabetical Order) > Code (numerical order).

I have seen a number of ways online to do this when wishing to filter and return the result on one object key but not on multiple ones.

This is something similar :
text.