From d57c125cbf16b541c45543e3386eb55b282e9e0f Mon Sep 17 00:00:00 2001 From: Kate Date: Sun, 15 Sep 2024 11:37:57 +0700 Subject: [PATCH 1/4] =?UTF-8?q?=D0=BF=D0=B8=D1=88=D0=B5=D1=82=20=D1=84?= =?UTF-8?q?=D1=83=D0=BD=D0=BA=D1=86=D0=B8=D1=8E=20checkStringLength?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.html | 1 + js/functions.js | 0 2 files changed, 1 insertion(+) create mode 100644 js/functions.js diff --git a/index.html b/index.html index 9fb6740..1737192 100644 --- a/index.html +++ b/index.html @@ -234,5 +234,6 @@

Не удалось загрузить данны + diff --git a/js/functions.js b/js/functions.js new file mode 100644 index 0000000..e69de29 From 006f07290acc846501d2cdd112213418dc2d6732 Mon Sep 17 00:00:00 2001 From: Kate Date: Sun, 15 Sep 2024 12:37:32 +0700 Subject: [PATCH 2/4] =?UTF-8?q?=D0=BF=D0=B8=D1=88=D0=B5=D1=82=20=D1=84?= =?UTF-8?q?=D1=83=D0=BD=D0=BA=D1=86=D0=B8=D1=8E=20isPalindrome?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- js/functions.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/js/functions.js b/js/functions.js index e69de29..2d3b9c5 100644 --- a/js/functions.js +++ b/js/functions.js @@ -0,0 +1,23 @@ +function checkStringLength (string, maxLength) { + const currentLength = string.length; + + if (currentLength <= maxLength) { + return true; + } + + return false; +} + +function isPalindrome (str) { + const normalizedString = str.toLowerCase().replaceAll(' ', ''); + let newString = ''; + const currentLength = normalizedString.length; + + for (let currentIndex = currentLength - 1; currentIndex >= 0; currentIndex--) { + let currentSymbol = normalizedString[currentIndex]; + newString += currentSymbol; + } + + console.log(newString); + return(newString === normalizedString); +} From f7c6004e52b8e0be11d9e0660a39c99df81670f1 Mon Sep 17 00:00:00 2001 From: Kate Date: Sun, 15 Sep 2024 12:38:18 +0700 Subject: [PATCH 3/4] =?UTF-8?q?=D1=83=D0=B1=D0=B8=D1=80=D0=B0=D0=B5=D1=82?= =?UTF-8?q?=20=D0=BB=D0=B8=D1=88=D0=BD=D0=B5=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- js/functions.js | 1 - 1 file changed, 1 deletion(-) diff --git a/js/functions.js b/js/functions.js index 2d3b9c5..84dfc04 100644 --- a/js/functions.js +++ b/js/functions.js @@ -18,6 +18,5 @@ function isPalindrome (str) { newString += currentSymbol; } - console.log(newString); return(newString === normalizedString); } From cdef186385be986219ff1227093c68c599b7f557 Mon Sep 17 00:00:00 2001 From: Kate Date: Mon, 16 Sep 2024 12:13:06 +0700 Subject: [PATCH 4/4] =?UTF-8?q?=D0=BF=D0=B5=D1=80=D0=B5=D0=B8=D0=BC=D0=B5?= =?UTF-8?q?=D0=BD=D0=BE=D0=B2=D1=8B=D0=B2=D0=B0=D0=B5=D1=82=20=D1=84=D1=83?= =?UTF-8?q?=D0=BD=D0=BA=D1=86=D0=B8=D1=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- js/functions.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/functions.js b/js/functions.js index 84dfc04..038eb98 100644 --- a/js/functions.js +++ b/js/functions.js @@ -8,7 +8,7 @@ function checkStringLength (string, maxLength) { return false; } -function isPalindrome (str) { +function checkPalindrome (str) { const normalizedString = str.toLowerCase().replaceAll(' ', ''); let newString = ''; const currentLength = normalizedString.length;