I get a json data on ajax success like this.
var videolist = [
{
"video_id": 0,
"video_name": "Guerrero Beard",
"timelength": 15
},
{
"video_id": 1,
"video_name": "Hallie Key",
"timelength": 8
},
{
"video_id": 2,
"video_name": "Pitts Lloyd",
"timelength": 27
},
{
"video_id": 3,
"video_name": "Corine Deleon",
"timelength": 14
}
]
And I filtered it by timelength > 10 and it works.
var result = [];
$.each(videolist, function(i, o){
if(videolist[i].timelength >10)
result.push(videolist[i]);
});
console.log(result);
But I also need to sort it. How can I sort this array?