|
@@ -1,69 +1,123 @@
|
|
|
// Год рождения //
|
|
|
|
|
|
-//let years = prompt('How old are you ?')
|
|
|
-//alert('You were born in ' + (2020 - years))
|
|
|
+function old() {
|
|
|
+let years = prompt('How old are you ?')
|
|
|
+alert('You were born in ' + (2020 - years))
|
|
|
+}
|
|
|
+let whenBorn = document.querySelector('.how-old-are-you')
|
|
|
+whenBorn.onclick = function() {
|
|
|
+ old();
|
|
|
+}
|
|
|
|
|
|
// =============================================//
|
|
|
// Температура //
|
|
|
|
|
|
-//let degree = prompt('what is your temperature ?')
|
|
|
-//alert('Your temperature is ' + (degree * (9/5) + 32) + ' Fahrenheit');
|
|
|
+function temp(){
|
|
|
+let degree = prompt('what is your temperature ?')
|
|
|
+alert('Your temperature is ' + (degree * (9/5) + 32) + ' Fahrenheit');
|
|
|
+}
|
|
|
+let tempShow = document.querySelector('.temperature')
|
|
|
+tempShow.onclick = function() {
|
|
|
+ temp();
|
|
|
+}
|
|
|
|
|
|
//==============================================//
|
|
|
// Number: divide //
|
|
|
|
|
|
-//let firstNumber = prompt('Write some number');
|
|
|
-//let secondNumber = prompt('Write some number');
|
|
|
-//alert(Math.floor(firstNumber/secondNumber));
|
|
|
+function numberDivide() {
|
|
|
+let firstNumber = prompt('Write some number');
|
|
|
+let secondNumber = prompt('Write some number');
|
|
|
+alert(Math.floor(firstNumber/secondNumber));
|
|
|
+}
|
|
|
+let divideShow = document.querySelector('.number-divide')
|
|
|
+divideShow.onclick = function() {
|
|
|
+ numberDivide();
|
|
|
+}
|
|
|
|
|
|
//==============================================//
|
|
|
// Number: odd //
|
|
|
|
|
|
-// let number = prompt('Write a number');
|
|
|
-// if(+number) {
|
|
|
-// alert('good job');
|
|
|
-// } else {
|
|
|
-// alert('Print an even number or not even');
|
|
|
-// number;
|
|
|
-// }
|
|
|
+function numberOdd() {
|
|
|
+let number = prompt('Write a number');
|
|
|
+if(+number) {
|
|
|
+ alert('good job');
|
|
|
+} else {
|
|
|
+ alert('Print an even number or not even');
|
|
|
+ number;
|
|
|
+}
|
|
|
+}
|
|
|
+let oddShow = document.querySelector('.number-odd')
|
|
|
+oddShow.onclick = function() {
|
|
|
+ numberOdd();
|
|
|
+}
|
|
|
|
|
|
//==============================================//
|
|
|
// String: greeting //
|
|
|
|
|
|
-// let name = prompt('What is your name ?');
|
|
|
-// alert('Hello ' + name);
|
|
|
+function stringGreeting() {
|
|
|
+let name = prompt('What is your name ?');
|
|
|
+alert('Hello ' + name);
|
|
|
+}
|
|
|
+let greetingShow = document.querySelector('.string-greeting')
|
|
|
+greetingShow.onclick = function() {
|
|
|
+ stringGreeting();
|
|
|
+}
|
|
|
|
|
|
//==============================================//
|
|
|
// String: lexics //
|
|
|
|
|
|
-// let text = prompt('Write some text here');
|
|
|
-// if(text.includes('fuck')) {
|
|
|
-// alert("Don't use curse words, you fucking asshole");
|
|
|
-// } else {
|
|
|
-// alert("It's fine, bro");
|
|
|
-// }
|
|
|
+function stringLexic() {
|
|
|
+let text = prompt('Write some text here');
|
|
|
+if(text.includes('fuck')) {
|
|
|
+ alert("Don't use curse words, you fucking asshole");
|
|
|
+} else {
|
|
|
+ alert("It's fine, bro");
|
|
|
+}
|
|
|
+}
|
|
|
+let lexicShow = document.querySelector('.string-lexics')
|
|
|
+lexicShow.onclick = function() {
|
|
|
+ stringLexic();
|
|
|
+}
|
|
|
|
|
|
//==============================================//
|
|
|
// confirm //
|
|
|
|
|
|
-// let idiot = confirm('Are you idiot ?')
|
|
|
-// alert(idiot);
|
|
|
+function confirmA() {
|
|
|
+let idiot = confirm('Are you idiot ?')
|
|
|
+alert(idiot);
|
|
|
+}
|
|
|
+let confirmShow = document.querySelector('.confirm')
|
|
|
+confirmShow.onclick = function() {
|
|
|
+ confirmA();
|
|
|
+}
|
|
|
|
|
|
//==============================================//
|
|
|
// Boolean //
|
|
|
|
|
|
-// let children = confirm('Do you have children ?')
|
|
|
-// let childrenNumber = children;
|
|
|
+function booleanA() {
|
|
|
+let children = confirm('Do you have children ?')
|
|
|
+let childrenNumber = children;
|
|
|
+}
|
|
|
+let booleanAShow = document.querySelector('.boolean')
|
|
|
+booleanAShow.onclick = function() {
|
|
|
+ booleanA();
|
|
|
+}
|
|
|
|
|
|
//==============================================//
|
|
|
// Boolean: if //
|
|
|
|
|
|
-// let penis = confirm('Do you have a penis ?')
|
|
|
-// if(penis == true) {
|
|
|
-// alert('Congratulations, you are the man ! ! ! ! !')
|
|
|
-// } else {
|
|
|
-// alert('Feel sorry for you, you are the girl')
|
|
|
-// }
|
|
|
+function booleanIf() {
|
|
|
+let penis = confirm('Do you have a penis ?')
|
|
|
+if(penis == true) {
|
|
|
+ alert('Congratulations, you are the man ! ! ! ! !')
|
|
|
+} else {
|
|
|
+ alert('Feel sorry for you, you are the girl')
|
|
|
+}
|
|
|
+}
|
|
|
+let booleanIfShow = document.querySelector('.boolean-if')
|
|
|
+booleanIfShow.onclick = function() {
|
|
|
+ booleanIf();
|
|
|
+}
|
|
|
|
|
|
//==============================================//
|
|
|
// Array: real //
|
|
@@ -75,6 +129,7 @@
|
|
|
|
|
|
// СНИНИЙ ПОЯС //
|
|
|
|
|
|
+function blueBeltPog() {
|
|
|
let apps = 144;
|
|
|
let entry = 4;
|
|
|
let floor = 9;
|
|
@@ -83,6 +138,15 @@ let a = apps / (entry * floor); // квартир на этаже
|
|
|
let ab = apps / entry; // в одном подъезде квартир
|
|
|
let cb = Math.trunc(1 + (k - 1) / ab); // Номер подъезда
|
|
|
let cd = Math.trunc(1 + ((k - 1) % ab) / a); // Номер этажа
|
|
|
+if(k > 144) {
|
|
|
+ alert('Нет такой квриты')
|
|
|
+} else {
|
|
|
alert('Подъезд: ' + cb + ' Этаж; ' + cd);
|
|
|
+}
|
|
|
+}
|
|
|
+let blueBeltPogShow = document.querySelector('.blue-belt')
|
|
|
+blueBeltPogShow.onclick = function() {
|
|
|
+ blueBeltPog();
|
|
|
+}
|
|
|
|
|
|
//==============================================//
|