File tree Expand file tree Collapse file tree 2 files changed +25
-0
lines changed Expand file tree Collapse file tree 2 files changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -234,5 +234,6 @@ <h2 class="data-error__title">Не удалось загрузить данны
234
234
</ section >
235
235
</ template >
236
236
237
+ < script src ="/js/functions.js "> </ script >
237
238
</ body >
238
239
</ html >
Original file line number Diff line number Diff line change
1
+ function isLesserOrEqual ( string , maxLength ) {
2
+ return string . length <= maxLength ;
3
+ }
4
+
5
+ function isPalindrome ( string ) {
6
+ const normalizedString = string . replaceAll ( ' ' , '' ) . toLowerCase ( ) ;
7
+ const reversedString = normalizedString . split ( '' ) . reverse ( ) . join ( '' ) ;
8
+
9
+ return normalizedString === reversedString ;
10
+ }
11
+
12
+ function toPositiveNumber ( string ) {
13
+ const normalizedString = string . toString ( ) . replaceAll ( ' ' , '' ) ;
14
+ let result = '' ;
15
+
16
+ for ( let i = 0 ; i < normalizedString . length ; i ++ ) {
17
+ if ( ! isNaN ( Number ( normalizedString [ i ] ) ) ) {
18
+ result += normalizedString [ i ] ;
19
+ }
20
+ }
21
+
22
+ return parseInt ( result , 10 ) ;
23
+ }
24
+
You can’t perform that action at this time.
0 commit comments