JSFiddle - React, Tailwind, and code Playground
by wenyi
HTML
<pre></pre>
JavaScript
var arr = [
{
time: '2015-12-12 12:12:12'
},
{
time: '2015-10-10 10:10:10'
},
{
time: '2015-11-11 11:11:11'
}
];
arr.sort(function (a, b) {
if (a.time < b.time) return 1;
if (a.time > b.time) return -1;
return 0;
});
$('pre').html(JSON.stringify(arr, null, 4));