Skip to content

Commit 2ef15d3

Browse files
author
Юлия Перелыгина
committed
вносит правки после линта
1 parent 0d1e739 commit 2ef15d3

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

js/functions.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,16 @@
1+
/* eslint-disable no-console */
2+
13
const checkLength = (string = '', maxSymbols = 1) => string.length <= maxSymbols;
24

5+
console.log(checkLength('проверяемая строка', 20));
6+
console.log(checkLength('проверяемая строка', 18));
7+
console.log(checkLength('проверяемая строка', 10));
8+
39
function comparesStringLength(string, length) {
410
return string.length <= length;
511
}
612

13+
console.log(comparesStringLength('тест', 10));
714

815
const isPalindrome = (string = '') => {
916

@@ -19,12 +26,15 @@ const isPalindrome = (string = '') => {
1926

2027
};
2128

29+
console.log(isPalindrome('топот'));
30+
2231
const verifyPalindrome = (string) => {
2332
const normalizedString = string.replaceAll(' ', '').toUpperCase();
2433
const reverseString = normalizedString.split('').reverse().join('');
2534
return reverseString === normalizedString;
2635
};
2736

37+
console.log(verifyPalindrome('довод'));
2838

2939
const extractNumbers = (string) => {
3040
let result = '';
@@ -40,10 +50,12 @@ const extractNumbers = (string) => {
4050
return result === '' ? NaN : Number(result);
4151
};
4252

53+
console.log(extractNumbers('2023 год'));
4354

4455
function stringToNumber(str) {
4556
return Number(
4657
[...String(str)].filter((item) => !isNaN(parseInt(item, 10))).join('') || NaN
4758
);
4859
}
4960

61+
console.log(stringToNumber('ECMAScript 2022'));

0 commit comments

Comments
 (0)