From fb0148439daee8241e660d015fb146d340e0fe72 Mon Sep 17 00:00:00 2001 From: Artem Melnyk <51422045+MellKam@users.noreply.github.com> Date: Sun, 21 Apr 2024 16:34:15 +0200 Subject: [PATCH] fix: joaat calculator (#3) * fix: joaat calc * remove console.log * rename to hash * make code cleaner --- src/components/Joaat/Joaat.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/Joaat/Joaat.jsx b/src/components/Joaat/Joaat.jsx index 10d1c82..4546b6d 100644 --- a/src/components/Joaat/Joaat.jsx +++ b/src/components/Joaat/Joaat.jsx @@ -9,11 +9,11 @@ function JOAATCalculator() { const [showKarby, setShowKarby] = useState(false); const calculateJOAAT = (str) => { + str = str.toLowerCase(); let hash = 0; for (let i = 0; i < str.length; i++) { - const char = str.charCodeAt(i); - hash += char; + hash += str.charCodeAt(i); hash += (hash << 10); hash ^= (hash >>> 6); }