Skip to content

Commit

Permalink
Merge pull request #2 from furidasha/module2-task1
Browse files Browse the repository at this point in the history
  • Loading branch information
keksobot authored Nov 28, 2024
2 parents be30417 + f30b949 commit 2c7de8f
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
1 change: 1 addition & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -234,5 +234,6 @@ <h2 class="data-error__title">Не удалось загрузить данны
</section>
</template>

<script src="js/functions.js"></script>
</body>
</html>
28 changes: 28 additions & 0 deletions js/functions.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// Функция для проверки, является ли строка длиннее заданного числа

const isStringLonger = (string = '', maxLength = 1) => string.length <= maxLength;

Check failure on line 3 in js/functions.js

View workflow job for this annotation

GitHub Actions / Check

'isStringLonger' is assigned a value but never used


// Функция для проверки, является ли строка палиндромом

const isPalindrom = (string = '') => {

Check failure on line 8 in js/functions.js

View workflow job for this annotation

GitHub Actions / Check

'isPalindrom' is assigned a value but never used
string = string.toLowerCase().replaceAll(' ', '');
let reverseString = '';
for (let i = 0; i < string.length; i++) {
reverseString += string[string.length - 1 - i];
}
return string === reverseString;
}

Check failure on line 15 in js/functions.js

View workflow job for this annotation

GitHub Actions / Check

Missing semicolon

// Функция для извлечения числа из строки

const extractNumber = (string) => {

Check failure on line 19 in js/functions.js

View workflow job for this annotation

GitHub Actions / Check

'extractNumber' is assigned a value but never used
string = string.toString();
let number = '';
for (let i = 0; i < string.length; i++) {
if (!isNaN(parseInt(string[i]))) {

Check failure on line 23 in js/functions.js

View workflow job for this annotation

GitHub Actions / Check

Missing radix parameter
number += string[i];
}
}
return parseInt(number);

Check failure on line 27 in js/functions.js

View workflow job for this annotation

GitHub Actions / Check

Missing radix parameter
}

Check failure on line 28 in js/functions.js

View workflow job for this annotation

GitHub Actions / Check

Missing semicolon

0 comments on commit 2c7de8f

Please sign in to comment.