Skip to content

Commit

Permalink
Merge pull request #2 from KateSolodchuk/module2-task1
Browse files Browse the repository at this point in the history
  • Loading branch information
keksobot authored Sep 17, 2024
2 parents 6c23b1c + cdef186 commit 3423586
Show file tree
Hide file tree
Showing 2 changed files with 23 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>
22 changes: 22 additions & 0 deletions js/functions.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
function checkStringLength (string, maxLength) {

Check failure on line 1 in js/functions.js

View workflow job for this annotation

GitHub Actions / Check

'checkStringLength' is defined but never used
const currentLength = string.length;

if (currentLength <= maxLength) {
return true;
}

return false;
}

function checkPalindrome (str) {

Check failure on line 11 in js/functions.js

View workflow job for this annotation

GitHub Actions / Check

'checkPalindrome' is defined but never used
const normalizedString = str.toLowerCase().replaceAll(' ', '');
let newString = '';
const currentLength = normalizedString.length;

for (let currentIndex = currentLength - 1; currentIndex >= 0; currentIndex--) {
let currentSymbol = normalizedString[currentIndex];

Check failure on line 17 in js/functions.js

View workflow job for this annotation

GitHub Actions / Check

'currentSymbol' is never reassigned. Use 'const' instead
newString += currentSymbol;
}

return(newString === normalizedString);
}

0 comments on commit 3423586

Please sign in to comment.