//1.assign: evaluation
// var a = 5;  
// var b, c;
// b = a * 5;  
// b = c = b/2;
// console.log(b, c);

//2.semicolon: error
// const hey = 'hey'
// const you = 'hey'
// const heyYou = hey + ' ' + you
// [‘h’, ‘e’, ‘y’].forEach((letter) => console.log(letter))

//3.semicolon: mistake
// const degC = (degF) => {
//     return degF - 32 * 5/9;
// }
// console.log(degC(36));

//4.Number: age
// let age = parseInt(+prompt('How old are you?'));
// let currentYear = (new Date()).getFullYear(); 
// if(age > 0){
//     alert(`${currentYear - age} is your year of Born`);
// }
// else {
//     alert('You made mistake');
// }


//5.Number: temperature
// let degC = +prompt('How many degrees in Celsius?');
// let degF = degC * 1.8 + 32;
// alert(`${degF} degrees in Fahrenheit`);

//6.Number: divide
// function divide(a, b) {
//     return Math.floor(a/b);
// }
// console.log(divide(5, 2));

//7.Number: odd
// let num = +prompt('Write your number:');
// if (isNaN(num)) {
//     alert('Error');
// }
// else if (!(Number.isInteger(num))) {
//     alert('Number is not integer');
// }
// else if(num % 2 == 0) {
//     alert('Your number is even');
// }
// else {
//     alert('Your number is odd');
// }

//8.String: greeting
// let userName = prompt('What is your name?');
// alert(`Hello ${userName}! Have a nice day!`);

//9.String: lexics
// let text = prompt('Say something');
// console.log(text.indexOf('el'));

//10.confirm
// let result = confirm('Are you here?');
// alert(typeof result);
// alert(result);

//11.Boolean
// let happy = confirm('Are you happy?');
// let pet = confirm('Do you have pet?');
// let cat = confirm('Is it cat?');
// let dog = confirm('Is it dog');
// console.log(happy, pet, cat, dog);

//12.Boolean: if
// let man = confirm('Are you a man?');
// let woman = confirm('Are you a woman?');
// if(man === true) {
//     alert('You are a man');
// }
// else {
//     alert('You are a woman');
// }

//13.Array: real
// let colors = ['blue', 'yellow', 'pink', 'red', 'white', 'black', 'green', 'gray'];

//14.Array: booleans
// let arr = ['happy', 'pet', 'cat', 'dog', 'man', 'woman'];

//15.Array: plus
// let arr = ['happy', 'pet', 'cat', 'dog', 'man', 'woman'];
// arr[2] = `${arr[0]}  ${arr[1]}`;
// let arrNum = [1, 2, 4, 5];
// arrNum[2] = arrNum[0] + arrNum[1];
// console.log(arr, arrNum);

//16.Array: plus string
// let arr = ['a', 'b', 'c', '1', '2', '3'];
// arr[3] = arr[0] + arr[1] + arr[2];
// console.log(arr);

//17.Object: real
// let user = {
//     name: 'Ben',
//     age: 17,
//     login: 'login',
//     password: 'pswd',
//     device: {
//         phone: 'Sumsung',
//         laptop: 'Lenovo'
//     }
// };
// console.log(user.device.phone);

//18.Object: change
// let user = {
//     name: 'Ben',
//     age: 17,
//     login: 'login',
//     password: 'pswd',
//     device: {
//         phone: 'Sumsung',
//         laptop: 'Lenovo'
//     }
// };
// user['name'] = 'Kate';
// user.device.phone = 'iphone';
// console.log(user);

//19.Comparison if
// var age = +prompt("Сколько вам лет?","");
// if (age < 0) {
//     alert('Error');
// }
// else if  (age <= 17){
//     alert("школьник");
// }
// else if (age <= 29){
//     alert("молодеж");
// }
// else if (age <= 44){
//     alert("зрелость");
// }
// else if (age <= 59){
//     alert("закат");
// }
// else if (age >= 60){
//     alert("как пенсия?");
// }
// else {
//     alert("то ли киборг, то ли ошибка"); 
// };

//20.Comparison: sizes, 21.Comparison: object
// let clothes = {
//     outerwear: {
//         russia : [40, 42, 44, 46, 48, 50, 52, 54],
//         german : [34, 36, 38, 40, 43, 44, 46, 48],
//         france : [36, 38, 40, 42, 44, 46, 48, 50],
//         italy : [38, 40, 42, 44, 46, 48, 50, 52],
//         gb : [8, 10, 12, 14, 16, 18, 20, 22],
//         usa : ['S', 'M', 'M', 'L', 'L', 'XL', 'XL', 'XXL']
//     },
//     lingerie : {
//         international : ['XXS', 'XS', 'S', 'M', 'L', 'XL', 'XXL', 'XXXL'],
//         russia : [42, 44, 46, 48, 50, 52, 54, 56],
//         german : [36, 38, 40, 42, 44, 46, 48, 50],
//         usa : [8, 10, 12, 14, 16, 18, 20, 22],
//         france : [38, 40, 42, 44, 46, 48, 50, 52],
//         gb : [24, 26, 28, 30, 32, 34, 36, 38]
//     },
//     socks : {
//         russia: [21, 22, 23, 24, 25, 26, 27],
//         europe : [0, 1, 2, 3, 4, 5, 6],
//         usa : [8, 8.5, 9, 9.5, 10, 10.5, 11]
//     }  
// };
// let wear = prompt('Which clothes do you need? Write your answer: outerwear/lingerie/socks', '');
// let size = +prompt('Which size do you want to change to different system?');
// let countryFrom = prompt('From which country system? russia/german/france/italy/gb/usa');
// let countryTo = prompt('To which country system? russia/german/france/italy/gb/usa');


// let index = clothes[wear][countryFrom].indexOf(size);
// let arrCountryTo = clothes[wear][countryTo];
// let sizeCountryTo = arrCountryTo[index];
// alert(`The size ${size} from ${countryFrom} system is ${sizeCountryTo} size in ${countryTo} system`);


//22.Ternary
// let qw = confirm('Are you a man?');
// qw ===true ? alert('You are a man') : alert('You are a woman');

//23.Синий пояс Number: flats
// let floorsInEntrance = +prompt('Сколько этажей в подъезде?');
// let flatsOnFloor = +prompt('Сколько квартир на этаже?');
// let flat = +prompt('Номер квартиры?');

// let flatsInEntrance = floorsInEntrance * flatsOnFloor;
// let entrance = Math.ceil(flat / flatsInEntrance);
// let x = flat - flatsInEntrance * (entrance - 1);
// let floor = Math.ceil(x / flatsOnFloor);

// alert(`Квартина # ${flat} находится в подъезде # ${entrance} на ${floor} этаже`);