Skip to content

Commit

Permalink
Merge pull request #2 from YouAreNotReady/module2-task1
Browse files Browse the repository at this point in the history
  • Loading branch information
keksobot authored Nov 18, 2024
2 parents 237287c + 2fab576 commit 00f890a
Show file tree
Hide file tree
Showing 2 changed files with 25 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>
24 changes: 24 additions & 0 deletions js/functions.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
function isLesserOrEqual(string, maxLength) {

Check failure on line 1 in js/functions.js

View workflow job for this annotation

GitHub Actions / Check

'isLesserOrEqual' is defined but never used
return string.length <= maxLength;
}

function isPalindrome(string) {

Check failure on line 5 in js/functions.js

View workflow job for this annotation

GitHub Actions / Check

'isPalindrome' is defined but never used
const normalizedString = string.replaceAll(' ', '').toLowerCase();
const reversedString = normalizedString.split('').reverse().join('');

return normalizedString === reversedString;
}

function toPositiveNumber(string) {

Check failure on line 12 in js/functions.js

View workflow job for this annotation

GitHub Actions / Check

'toPositiveNumber' is defined but never used
const normalizedString = string.toString().replaceAll(' ', '');
let result = '';

for (let i = 0; i < normalizedString.length; i++) {
if(!isNaN(Number(normalizedString[i]))) {
result += normalizedString[i];
}
}

return parseInt(result, 10);
}

0 comments on commit 00f890a

Please sign in to comment.