katsparrow / homework

0 stars 0 forks source link

js 1 #3

Open ivchenkodima opened 7 years ago

ivchenkodima commented 7 years ago
<html>
    <head>
        <title></title>
        <script>
            var age = 23;
            var name = 'Katya';
            var child;
            var a = null;
            var female = true;
            var person = {
                age: 25,
                name: "Dima"
            };

            var f = 3, d = '3';
            var result = f==d;      
            var str = "Enter your age";

            do {
                age2 = +prompt(str);
                var pensionAge = 60, 
                maxAge = 120;
                if (isNaN(age2)){
                    str = " Wrong age! Please, enter number!"
                    continue;
                }
                if (age2 == 0) {
                    break;
                }
                if (age2 < 18){
                    console.log("You are younge");
                } else if (age2 >= 18 && age2 <= pensionAge){
                    console.log("Ok");
                } else if (age2 > pensionAge && age2 < maxAge){
                    console.log("You should have bank account");
                } else {
                    console.log("Unreal");
                }
            } while (isNaN(age2))
        </script>
    </head>
    <body>
    </body>
</html>