JSFiddle - React, Tailwind, and code Playground
HTML
<h1>Open the console</h1>
JavaScript
var data = [
[
{name:"John", age:32, x:false},
{name:"Mark", age:44, x:false},
{name:"John", age:21, x:true}
],
[
{name:"John", age:65, x:false},
{name:"Mark", age:77, x:false},
{name:"John", age:78, x:true}
],
[
{name:"John", age:11, x:false},
{name:"Mark", age:15, x:false},
{name:"John", age:65, x:true}
]
];
console.log(data);
function compare(a,b) {
if (b.x)
return 1;
if (a.x)
return -1;
return 0;
}
for(var i=0,l=data.length; i<l; i++) data[i].sort(compare);
console.log(data);