Skip to content

Commit

Permalink
JsonSort
Browse files Browse the repository at this point in the history
  • Loading branch information
lixinso committed Nov 14, 2021
1 parent ee9bacd commit 122a7a6
Showing 1 changed file with 24 additions and 5 deletions.
29 changes: 24 additions & 5 deletions JavaScript/JsonSort.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,28 @@

var people = [
{
"f_name": "john",
"f_name": "111",
"l_name": "doe",
"sequence": "0",
"sequence": "1",
"title" : "president",
"url" : "google.com",
"color" : "333333",
"color" : "",
},
{
"f_name": "333",
"l_name": "doe",
"sequence": "3",
"title" : "president",
"url" : "google.com",
"color" : "",
},
{
"f_name": "222",
"l_name": "doe",
"sequence": "2",
"title" : "president",
"url" : "google.com",
"color" : "",
}
// etc
];
Expand All @@ -23,8 +39,11 @@
return (b[prop] > a[prop]) ? 1 : ((b[prop] < a[prop]) ? -1 : 0);
}
});
renderResults();
//renderResults();
}


sortResults("sequence", true);

alert(JSON.stringify(people));

</script>

0 comments on commit 122a7a6

Please sign in to comment.