diff --git a/0-module/1-task/index.js b/0-module/1-task/index.js index 148ea5e..3e5e23f 100644 --- a/0-module/1-task/index.js +++ b/0-module/1-task/index.js @@ -1,3 +1,3 @@ function sum(m, n) { - // ваш код... + return m + n; // ваш код... } diff --git a/1-module/1-task/index.js b/1-module/1-task/index.js index 977f6f3..df94e43 100644 --- a/1-module/1-task/index.js +++ b/1-module/1-task/index.js @@ -1,3 +1,8 @@ function factorial(n) { - // ваш код... + + let fact = 1; + for (let i = 1; i <= n; i++) { + fact = fact * i; + } + return fact; // мой код... } diff --git a/1-module/2-task/index.js b/1-module/2-task/index.js index e59bf21..619a9cb 100644 --- a/1-module/2-task/index.js +++ b/1-module/2-task/index.js @@ -10,7 +10,12 @@ function print(text) { * чтобы функция sayHello работала корректно */ function isValid(name) { - // ваш код... + if (name === null || name.includes(" ") || name.length < 4 ) { + return false; + } + else { + return true; + } // мой код... } function sayHello() { diff --git a/1-module/3-task/index.js b/1-module/3-task/index.js index 5c3e6a5..e651f4e 100644 --- a/1-module/3-task/index.js +++ b/1-module/3-task/index.js @@ -1,3 +1,3 @@ function ucFirst(str) { - // ваш код... + return (str.slice(0, 1).toUpperCase () + str.slice(1)); // мой код... } diff --git a/1-module/4-task/index.js b/1-module/4-task/index.js index 08684b7..5d7a31f 100644 --- a/1-module/4-task/index.js +++ b/1-module/4-task/index.js @@ -1,3 +1,5 @@ -function checkSpam(str) { - // ваш код... -} +function checkSpam(str) { // мой код... + let strtoLowerCase = str.toLowerCase(); + return strtoLowerCase.includes('1xbet') || strtoLowerCase.includes('xxx'); + +} \ No newline at end of file diff --git a/1-module/5-task/index.js b/1-module/5-task/index.js index b1eda21..8039ab6 100644 --- a/1-module/5-task/index.js +++ b/1-module/5-task/index.js @@ -1,3 +1,3 @@ function truncate(str, maxlength) { - // ваш код... + return str.length > maxlength ? str.slice(0, maxlength - 1) + "…" : str; // мой код... }