Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Нужно больше функций #2

Merged
merged 2 commits into from
Oct 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<link rel="stylesheet" href="css/style.css">
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon">
<title>Кекстаграм</title>
<script src="js/functions.js"></script>
</head>

<body>
Expand Down
15 changes: 15 additions & 0 deletions js/functions.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
const stringValidate = (string, maxLength) => string.length <= maxLength ? true : false

Check failure on line 1 in js/functions.js

View workflow job for this annotation

GitHub Actions / Check

Unnecessary use of boolean literals in conditional expression

Check failure on line 1 in js/functions.js

View workflow job for this annotation

GitHub Actions / Check

Missing semicolon
stringValidate('mynewstring', 20);
// линтер ругается на консоль, проверял так: console.log(stringValidate('mynewstring', 20));

function palindromCheck (string) {
const normalizeString = String(string).replaceAll(' ', '').toLowerCase();
let emptyString = '';
const stringLastSym = normalizeString.length - 1;
rantbc marked this conversation as resolved.
Show resolved Hide resolved
for (let i = stringLastSym; i >= 0; i--) {
emptyString += normalizeString[i];
}
return normalizeString === emptyString;
}
palindromCheck('топот');
// линтер ругается на консоль, проверял так: console.log(valindromCheck('топот'));
Loading