From 409b3e147996ac3245881a9a15e7e91457813d63 Mon Sep 17 00:00:00 2001 From: Leon Xu Date: Mon, 2 May 2022 21:13:37 -0700 Subject: [PATCH] doc: create sortData variable to sort data --- src/util.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/util.js b/src/util.js index e69de29..b4b3707 100644 --- a/src/util.js +++ b/src/util.js @@ -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; + } + }); +}; \ No newline at end of file