extend javascript sort with 3rd arguement [duplicate]

  1. Sort it with the key type code 2,2,2,5,5

  2. Take that and sort it with type without changing the code order

  3. Take the second array and sort it with price without changing the code and type order

I put an example code in stackblitz.com

https://stackblitz.com/edit/react-ts-vjervg?file=App.tsx

Can someone pls help me on this.