I have an array of objects having attributes TechType
and ProductName
. The given array is already sorted by TechType
(not necessarily alphabetically); now within this sorted array, it has to be further sorted by ascending order based on ProductName
.
var products= [
{
"TechType": "ADSL",
"ProductName": " Zen ADSL Services",
}, {
"TechType": "ADSL",
"ProductName": "ADSL Services",
}, {
"TechType": "T1",
"ProductName": "T1-Voice",
},{
"TechType": "T1",
"ProductName": " Aviate T1-Voice",
}
];
The sorted array should be
var products= [
{
"TechType": "ADSL",
"ProductName": " ADSL Services",
}, {
"TechType": "ADSL",
"ProductName": "Zen ADSL Services",
}, {
"TechType": "T1",
"ProductName": " Aviate T1-Voice",
},{
"TechType": "T1",
"ProductName": " T1-Voice",
}
];