diff --git a/.eslintrc b/.eslintrc index 3ae897a..6224776 100644 --- a/.eslintrc +++ b/.eslintrc @@ -14,3 +14,8 @@ globals: extends: "htmlacademy/vanilla" + +rules: + quotes: [1, "double", "avoid-escape"] + no-unused-vars: warn + no-console: warn diff --git a/index.html b/index.html index 8a8acfa..c1030c3 100644 --- a/index.html +++ b/index.html @@ -3,6 +3,7 @@
+ diff --git a/js/functions.js b/js/functions.js new file mode 100644 index 0000000..895019a --- /dev/null +++ b/js/functions.js @@ -0,0 +1,29 @@ +function countLength (inputString, maxLen) { + const amount = inputString.length; + return amount <= maxLen; +} + +countLength("проверяемая строка", 10); + +function checkPalindrom(stringPalindrom){ + stringPalindrom = stringPalindrom.toLowerCase(); + stringPalindrom = stringPalindrom.replaceAll(" " , ""); + const reverseString = stringPalindrom.split("").reverse().join(""); + return stringPalindrom === reverseString; +} + +checkPalindrom("топот"); + +function findNumber(inputString) { + inputString = inputString.toString(); + let result = ""; + for (let i of inputString) { + i = parseInt(i, 10); + if(!isNaN(i)) { + result = result + i; + } + } + return (parseInt(result, 10)); +} + +console.log(findNumber('22 lalal 1'));