|
@@ -1,194 +0,0 @@
|
|
|
-<!DOCTYPE html>
|
|
|
-<html lang="en">
|
|
|
-
|
|
|
-<head>
|
|
|
- <meta charset="UTF-8">
|
|
|
- <meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
|
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
|
- <title>HW2</title>
|
|
|
-</head>
|
|
|
-
|
|
|
-<body>
|
|
|
- <script>
|
|
|
- { // Number: age
|
|
|
- let years = prompt("Введите ваш возраст", "")
|
|
|
- let year = 2022
|
|
|
- result = year - years
|
|
|
- alert(result + " год рождения.")
|
|
|
- }
|
|
|
-
|
|
|
- { //Number: temperature
|
|
|
- let celsius = prompt("Введите °C", "")
|
|
|
- fahren = (celsius * 9 / 5) + 32
|
|
|
- alert(fahren + "°F")
|
|
|
- }
|
|
|
-
|
|
|
- { //Number: divide
|
|
|
- let calc = prompt("Введите число которое хотите поделить", "")
|
|
|
- let calc2 = prompt("Введите число на которое нужно совершить деление", "")
|
|
|
- number = Math.floor(calc / calc2)
|
|
|
- alert(number + " результат")
|
|
|
- }
|
|
|
-
|
|
|
- // Number: odd
|
|
|
- {
|
|
|
- let number = prompt("Введите число:");
|
|
|
- if (number = Number(number)) {
|
|
|
- true;
|
|
|
- }
|
|
|
- else {
|
|
|
- alert("Введите число!");
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- { //String: greeting
|
|
|
- let name = prompt("Введите ваше имя", "")
|
|
|
- alert("Hallo! " + name)
|
|
|
- }
|
|
|
-
|
|
|
- // {
|
|
|
- // let text = prompt ("Введите текст ","")
|
|
|
- // let position = prompt(" проверка его на наличие некорректного слова", "")
|
|
|
- // text.indexOf()
|
|
|
- // alert(text.indexOf())
|
|
|
- // //text[position]
|
|
|
- // //alert(text[position])
|
|
|
- // }
|
|
|
-
|
|
|
- { //confirm
|
|
|
- let human = confirm("Ты человек?");
|
|
|
- alert(human); // true, если нажата OK
|
|
|
- }
|
|
|
-
|
|
|
- { //Boolean: if
|
|
|
- var container = confirm("Вы рожали ?", "");
|
|
|
- if (container) {
|
|
|
- alert("Вы женщина");
|
|
|
- } else {
|
|
|
- alert("Вы мужчина");
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- let myLife = ['sleep', 'eat', 'to study']; // Array: real
|
|
|
- var container = confirm[("Вы рожали ?", "")]; // Array: booleans
|
|
|
-
|
|
|
- b = [1] + [1] // Array: plus
|
|
|
- b.indexOf(2)
|
|
|
-
|
|
|
- a = ['left'] + ['right'] + ['top'] //Array: plus string
|
|
|
- a = 'leftrighttop'
|
|
|
-
|
|
|
- //Object: real
|
|
|
- let sneakers = {
|
|
|
- brand: "nike",
|
|
|
- model: "jordan",
|
|
|
- size: "38.5",
|
|
|
- color: "orange",
|
|
|
- };
|
|
|
-
|
|
|
- sneakers.color //Object: change
|
|
|
- 'orange'
|
|
|
- sneakers['brand']
|
|
|
- 'nike'
|
|
|
- sneakers['brand'] = "puma"
|
|
|
- sneakers['brand']
|
|
|
- 'puma'
|
|
|
-
|
|
|
- //Comparison if
|
|
|
- var age = +prompt("Сколько вам лет?", "");
|
|
|
- if (age < 0) {
|
|
|
- alert("Попался, бот ?")
|
|
|
- }
|
|
|
- else if (age <= 18) {
|
|
|
- alert("школьник");
|
|
|
- } else if (age > 18 && age <= 30) {
|
|
|
- alert("молодеж");
|
|
|
- } else if (age > 30 && age <= 45) {
|
|
|
- alert("зрелость");
|
|
|
- } else if (age > 45 && age <= 60) {
|
|
|
- alert("закат");
|
|
|
- } else if (age >= 60) {
|
|
|
- alert("как пенсия?");
|
|
|
- }
|
|
|
-
|
|
|
- //Comparison: sizes
|
|
|
-
|
|
|
- let sizeUk = prompt("Выберете размер женской обуви: \n34\n34.5\n35\n35.5\n36\n36.5\n37\n37.5\n38\n38.5\n39\n39.5\n40\n40.5");
|
|
|
- if (sizeUk == 34){
|
|
|
- alert (5 + " USA");
|
|
|
- }
|
|
|
- else if (sizeUk == 34.5){
|
|
|
- alert (5.5 + " USA");
|
|
|
- }
|
|
|
- else if (sizeUk == 35){
|
|
|
- alert (6 + " USA");
|
|
|
- }
|
|
|
- else if (sizeUk == 35.5){
|
|
|
- alert (6.5 + " USA");
|
|
|
- }
|
|
|
- else if (sizeUk == 36){
|
|
|
- alert (7 + " USA");
|
|
|
- }
|
|
|
- else if (sizeUk == 36.5){
|
|
|
- alert (7.5 + " USA");
|
|
|
- }
|
|
|
- else if (sizeUk == 37){
|
|
|
- alert (8 + " USA");
|
|
|
- }
|
|
|
- else if (sizeUk == 37.5){
|
|
|
- alert (8.5 + " USA");
|
|
|
- }
|
|
|
- else if (sizeUk == 38){
|
|
|
- alert (9 + " USA");
|
|
|
- }
|
|
|
- else if (sizeUk == 38.5){
|
|
|
- alert (9.5 + " USA");
|
|
|
- }
|
|
|
- else if (sizeUk == 39){
|
|
|
- alert (10 + " USA");
|
|
|
- }
|
|
|
- else if (sizeUk == 39.5){
|
|
|
- alert (10.5 + " USA");
|
|
|
- }
|
|
|
- else if (sizeUk == 40){
|
|
|
- alert (11 + " USA");
|
|
|
- }
|
|
|
- else if (sizeUk == 40.5){
|
|
|
- alert (11.5 + " USA");
|
|
|
- }
|
|
|
- else {
|
|
|
- alert ("ошибка")
|
|
|
- }
|
|
|
-
|
|
|
- //Comparison: object
|
|
|
- let shoes = {
|
|
|
- sizeUk: "34-40.5",
|
|
|
- sizeUSA: "5-11.5"
|
|
|
- }
|
|
|
-
|
|
|
- //Ternary
|
|
|
- let gender = confirm ("Вы женщина ?") ? "Отлично, вы женщина" : "Отлично, вы мужчина"
|
|
|
- alert(gender)
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- //Синий пояс Number: flats
|
|
|
- let floorHouse = prompt ("Введите количества этажей в доме")
|
|
|
- let numberApartment = prompt ("Введите номер квартиры")
|
|
|
- let apartmentFloor = prompt ("Введите количество квартир на этаже")
|
|
|
-
|
|
|
- let apartmentsHallway = floorHouse * apartmentFloor // кол-во квартир
|
|
|
- let entrance = numberApartment / apartmentsHallway // номер подъезда
|
|
|
- let floor = (numberApartment % apartmentsHallway) / apartmentFloor // номер этажа
|
|
|
-
|
|
|
- alert(Math.round(entrance) + " подъезд")
|
|
|
- alert(Math.round(floor) + " этаж")
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- </script>
|
|
|
-
|
|
|
- <script src="/add.js"></script>
|
|
|
-</body>
|
|
|
-
|
|
|
-</html>
|