doc: create sortData variable to sort data

This commit is contained in:
Leon Xu committed 2022-05-02 21:13:37 -07:00
1 parent d26d40b9be
commit 409b3e1479
1 file changed
+11
+11
View File
@@ -0,0 +1,11 @@
export const sortData = (data) => {
const sortedData = [...data];
sortedData.sort((a, b) => {
if (a.cases > b.cases) {
return -1;
} else {
return 1;
}
});
};