JSFiddle - React, Tailwind, and code Playground
HTML
<script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.21/lodash.min.js"></script>
JavaScript
var array = [
{
"F": "cis-1,2-Dichloroethene:MW-002",
"Chemical": "cis-1,2-Dichloroethene",
"LocName": "MW-002"
},
{
"F": "Tetrachloroethene:MW-004",
"Chemical": "Tetrachloroethene",
"LocName": "MW-004"
},
{
"F": "Tetrachloroethene:MW-003",
"Chemical": "Tetrachloroethene",
"LocName": "MW-003"
},
{
"F": "Tetrachloroethene:MW-002",
"Chemical": "Tetrachloroethene",
"LocName": "MW-002"
},
{
"F": "cis-1,2-Dichloroethene:MW-001",
"Chemical": "cis-1,2-Dichloroethene",
"LocName": "MW-001"
},
{
"F": "Tetrachloroethene:MW-001",
"Chemical": "Tetrachloroethene",
"LocName": "MW-001"
},
{
"F": "cis-1,2-Dichloroethene:MW-004",
"Chemical": "cis-1,2-Dichloroethene",
"LocName": "MW-004"
},
{
"F": "cis-1,2-Dichloroethene:MW-003",
"Chemical": "cis-1,2-Dichloroethene",
"LocName": "MW-003"
}
]
var temp = _.sortBy(array, ['Chemical', 'LocName']);
console.log(temp)