We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents f2296f4 + c99397d commit db85abcCopy full SHA for db85abc
index.html
@@ -234,5 +234,6 @@ <h2 class="data-error__title">Не удалось загрузить данны
234
</section>
235
</template>
236
237
+<script src="js/functions.js"></script>
238
</body>
239
</html>
js/functions.js
@@ -0,0 +1,16 @@
1
+const isLengthValid = (str = '', maxLength = 0) => str.length <= maxLength;
2
+
3
+isLengthValid('Hello World', 20);
4
5
+const isPalindrom = (str = '') => {
6
+ const normalizedStr = str.replaceAll(' ', '').toLowerCase();
7
+ let reversedStr = '';
8
9
+ for (let i = normalizedStr.length - 1; i >= 0; i--) {
10
+ reversedStr += normalizedStr[i];
11
+ }
12
13
+ return normalizedStr === reversedStr;
14
+};
15
16
+isPalindrom();
0 commit comments