diff --git a/Images/background_for_games.jpg b/Images/background_for_games.jpg new file mode 100644 index 0000000..a53d48c Binary files /dev/null and b/Images/background_for_games.jpg differ diff --git a/_mobile.scss b/_mobile.scss index 2f15a2f..7ca81d1 100644 --- a/_mobile.scss +++ b/_mobile.scss @@ -73,11 +73,11 @@ font-size: 14px; line-height: 22px; } - .footer____game-1 { + .footer__game-1 { display: flex; flex-direction: column; } - .footer____game-2 { + .footer__game-2 { display: flex; flex-direction: column-reverse; } diff --git a/game1script.js b/game1script.js new file mode 100644 index 0000000..e69de29 diff --git a/hw4script.js b/hw4script.js index c108a29..c31f8d5 100644 --- a/hw4script.js +++ b/hw4script.js @@ -52,10 +52,28 @@ // } // alert("Iterated " + num + " times!"); // Exercise 6 -let day = 5; -for (let day = 5; day <= 31; day += 7) { - // почему +=? почему +=7 не в фигурных скобках? - alert( - "Сегодня пятница, " + day + " -е число. Необходимо подготовить отчет.!" - ); +// let day = 5; +// for (let day = 5; day <= 31; day += 7) { +// // почему +=? почему +=7 не в фигурных скобках??? +// alert( +// "Сегодня пятница, " + day + " -е число. Необходимо подготовить отчет.!" +// ); +// } + +// Exercise 7 +// const obj = { +// Але: "ша", +// Гри: "ша", +// Ди: "ма", +// }; +// for (const capital in obj) { +// alert(capital + "- это " + obj[capital]); +// } +const obj = { + Baby: "Boss", + Art: "Museum", + Assassin: "creed Brotherhood", +}; +for (const game in obj) { + alert(game + "'S " + obj[game]); } diff --git a/hw5script.js b/hw5script.js new file mode 100644 index 0000000..5a26437 --- /dev/null +++ b/hw5script.js @@ -0,0 +1,144 @@ +// // Exercise 1 +// const least = (a, b) => { +// if (a < b) { +// return a; +// } else { +// return b; +// } +// }; +// console.log(least(4, 8)); +// console.log(least(6, 6)); +// // or +// function min(a, b) { +// return a < b ? a : b; +// } +// console.log(min(4, 8)); +// Exercise 2 +// const evenNum = (a) => { +// if (a % 2 == 0) { +// return "Четное число"; +// } else { +// return "Нечетное число"; +// } +// // Как сделать с prompt? +// }; +// alert(evenNum(7)); +//or + +// let number = prompt("Введите число"); + +// if (number % 2 == 0) { +// function evenNum() { +// alert("Четное число"); +// } +// } else { +// function evenNum() { +// alert("Нечетное число"); +// } +// } +// evenNum(); +// // or +// function evenNum(a) { +// return a % 2 == 0 ? "Четное число" : "Нечетное число"; +// } +// alert(evenNum(7)); +// // Exercise 3.2 +// const squareNum = (a) => { +// let result = a ** 2; +// return result; +// }; +// console.log(squareNum(3)); +// // Exercise 3.1 +// let number = prompt("Введите число"); +// function squareNum(a) { +// return a ** 2; +// } +// alert(squareNum(Number)); +// // Exercise 4 +// let age = prompt("Сколько Вам лет?"); +// if (age < 0) { +// function printMessage() { +// alert("Вы ввели неправильное значение"); +// } +// } else if (age < 12) { +// function printMessage() { +// alert("Привет, друг!"); +// } +// } else { +// function printMessage() { +// alert("Добро пожаловать!"); +// } +// } +// { +// } +// printMessage(); +// Exercise 5 +const mult = (a, b) => { + if (isNaN(a) || isNaN(b)) { + return "Одно или оба значения не являются числом"; + } + let result = a * b; + return result; +}; +alert(mult(prompt("Введите первое число"), prompt("Введите второе число"))); + +// // Exercise 6 +const mult = (a) => { + if (isNaN(a)) { + return "Значение не является числом"; + } + let result = a ** 3; + return result; +}; +alert(mult(prompt("Введите первое число"))); +// // Exercise 7 +// function getСircleArea() { +// return this.radius ** 2 * Math.PI; +// } +// function getСirclePerimeter() { +// return this.radius * 2 * Math.PI; +// } + +// const circle1 = { +// radius: 3, + +// getArea: getСircleArea, +// getPerimeter: getСirclePerimeter, +// }; + +// const circle2 = { +// radius: 7, + +// getArea: getСircleArea, +// getPerimeter: getСirclePerimeter, +// }; + +// alert(circle1.getArea()); +// alert(circle1.getPerimeter()); +// alert(circle2.getArea()); +// alert(circle2.getPerimeter()); +//// Exercise 8 +const season = (a) => { + if (isNaN(a)) { + return "Вы ввели не число"; + } + if (a == 12 || (a >= 1 && a <= 2)) { + // Ошибка в синтаксисе? Не видит число 12 + return "Зима"; + } else if (a >= 3 && a <= 5) { + return "Весна"; + } else if (a >= 6 && a <= 8) { + return "Лето"; + } else if (a >= 9 && a <= 11) { + return "Осень"; + } else { + return "Такого месяца не существует"; + } + { + } + { + } + { + } +}; +alert(season(prompt("Введите номер месяца"))); diff --git a/index.html b/index.html index e87db70..6c8da13 100644 --- a/index.html +++ b/index.html @@ -41,9 +41,9 @@