I have a data like this format.
var data = [
{id:1,
format:'txt',
array1:[
{id:10, txt:3, Nm:A},
{id:100, txt:2, Nm:B},
{id:1000, txt:1, Nm:C}
]
},
{id:2,
format:'vidz',
array1:[
{id:10,txt:5,Nm:X},
{id:100,txt:9,Nm:Y},
{id:1000,txt:6,Nm:Z}
]
}
]
need to sortby "txt" using underscoreJs or any javascript method
var data = [
{id:1,
format:'txt',
array1:[
{id:1000, txt:1, Nm:C},
{id:100, txt:2, Nm:B},
{id:10, txt:3, Nm:A}
]
},
{id:2,
format:'vidz',
array1:[
{id:10,txt:5,Nm:X},
{id:1000,txt:6,Nm:Z},
{id:100,txt:9,Nm:Y}
]
}
]
How to sortBy ascending order for the "txt" inside of array1