Skip to content

Commit 38f54ab

Browse files
authored
Merge pull request #2 from Julyova/module2-task1
2 parents d0d495b + 2ef15d3 commit 38f54ab

3 files changed

Lines changed: 73 additions & 7 deletions

File tree

index.html

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
<!DOCTYPE html>
22
<html lang="ru">
3+
34
<head>
45
<meta charset="utf-8">
56
<meta name="viewport" content="width=device-width,initial-scale=1">
67
<link rel="stylesheet" href="css/normalize.css">
78
<link rel="stylesheet" href="css/style.css">
89
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon">
910
<title>Кекстаграм</title>
11+
<script src="scripts/index.js" defer></script>
1012
</head>
1113

1214
<body>
@@ -162,7 +164,7 @@ <h2 class="big-picture__title visually-hidden">Просмотр фотогра
162164
</li>
163165
<li class="social__comment">
164166
<img class="social__picture" src="img/avatar-3.svg" alt="Аватар комментатора фотографии" width="35" height="35">
165-
<p class="social__text">Да это фоташоп!!!!!!!!</p>
167+
<p class="social__text">Да это фоташоп!!!!!!!!</p>
166168
</li>
167169
</ul>
168170

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

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

237239
</body>
240+
238241
</html>

js/functions.js

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
/* eslint-disable no-console */
2+
3+
const checkLength = (string = '', maxSymbols = 1) => string.length <= maxSymbols;
4+
5+
console.log(checkLength('проверяемая строка', 20));
6+
console.log(checkLength('проверяемая строка', 18));
7+
console.log(checkLength('проверяемая строка', 10));
8+
9+
function comparesStringLength(string, length) {
10+
return string.length <= length;
11+
}
12+
13+
console.log(comparesStringLength('тест', 10));
14+
15+
const isPalindrome = (string = '') => {
16+
17+
string = string.replaceAll(' ', '').toLowerCase();
18+
19+
let reversed = '';
20+
21+
for (let i = string.length - 1; i >= 0; i--) {
22+
reversed += string[i];
23+
}
24+
25+
return string === reversed;
26+
27+
};
28+
29+
console.log(isPalindrome('топот'));
30+
31+
const verifyPalindrome = (string) => {
32+
const normalizedString = string.replaceAll(' ', '').toUpperCase();
33+
const reverseString = normalizedString.split('').reverse().join('');
34+
return reverseString === normalizedString;
35+
};
36+
37+
console.log(verifyPalindrome('довод'));
38+
39+
const extractNumbers = (string) => {
40+
let result = '';
41+
42+
string = string.toString();
43+
44+
for (let i = 0; i <= string.length - 1; i++) {
45+
if (Number.isNaN(parseInt(string[i], 10)) === false) {
46+
result += string[i];
47+
}
48+
}
49+
50+
return result === '' ? NaN : Number(result);
51+
};
52+
53+
console.log(extractNumbers('2023 год'));
54+
55+
function stringToNumber(str) {
56+
return Number(
57+
[...String(str)].filter((item) => !isNaN(parseInt(item, 10))).join('') || NaN
58+
);
59+
}
60+
61+
console.log(stringToNumber('ECMAScript 2022'));

package-lock.json

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)