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

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

Merged
merged 4 commits into from
Nov 23, 2024
Merged
Show file tree
Hide file tree
Changes from 3 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
20 changes: 11 additions & 9 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<!DOCTYPE html>
<html lang="ru">

<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
Expand Down Expand Up @@ -162,7 +163,7 @@ <h2 class="big-picture__title visually-hidden">Просмотр фотогра
</li>
<li class="social__comment">
<img class="social__picture" src="img/avatar-3.svg" alt="Аватар комментатора фотографии" width="35" height="35">
<p class="social__text">Да это фоташоп!!!!!!!!</p>
<p class="social__text">Да это фоташоп!!!!!!!!</p>
</li>
</ul>

Expand Down Expand Up @@ -227,12 +228,13 @@ <h2 class="success__title">Изображение успешно загруже
</section>
</template>

<!-- Сообщение с ошибкой загрузки изображений от других пользователей -->
<template id="data-error">
<section class="data-error">
<h2 class="data-error__title">Не удалось загрузить данные</h2>
</section>
</template>

<!-- Сообщение с ошибкой загрузки изображений от других пользователей -->
<template id="data-error">
<section class="data-error">
<h2 class="data-error__title">Не удалось загрузить данные</h2>
</section>
</template>
<script src="js/functions.js"></script>
</body>
</html>

</html>
25 changes: 25 additions & 0 deletions js/functions.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
function checkStr(string, length) {
return string.length <= length;
}

checkStr('fff', 3);

function isPalimdrome(string) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isPalindrome

string = string.replaceAll(' ', '');
const reversedString = string.split('').reverse().join('');
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Не учтен случай, когда строка содержит символы в разном регистре

return string === reversedString;
}
isPalimdrome('ooppoo ooppoo');
function getNums(string) {
string = String(string);
let result = '';
for (let i = 0; i < string.length; i++) {
if (!isNaN(parseInt(string[i], 10))) {
result += string[i];
}
}
return parseInt(result, 10);
}

getNums('ou8kj9');

Loading