I am currently working with an array of objects that contain a property named 'CODE'.
[
{
ID: 168,
NAME: "First name",
CODE: "AD"
},
{
ID: 167,
NAME: "Second name",
CODE: "CC"
},
{
ID: 169,
NAME: "Third name",
CODE: "CCM"
},
{
ID: 170,
NAME: "Fourth name",
CODE: "CR"
},
]
My question is, how can I sort this array based on a customized order such as:
var item_order = ["CCM","CR","AD","CC"];
I have attempted different methods but so far without any success. Any assistance would be greatly appreciated.