day HTML 05_1

JTH·2023년 2월 27일
0

gb_jth

목록 보기
49/56

HelloWorld

<!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>Document</title>
</head>
<body>
    <script>
        // alert('Hello world');

        console.log('Hello world');
    </script>
</body>
</html>

사칙 연산

<!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>Document</title>
</head>
<body>
    <script>
        // 사칙연산
        var num1 = 100 + 30;
        var num2 = 100 - 30;
        var num3 = 100 * 30;
        var num4 = 100 / 30;
        var num5 = 100 % 30;

        console.log(num1);
        console.log(num2);
        console.log(num3);
        console.log(num4);
        console.log(num5);
    </script>
</body>
</html>

단항 연산자

<!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>Document</title>
</head>
<body>
    <script>
        // 단항 연산자
        var num = 100;
        
        num += 5;
        console.log(num);

        num -= 3;
        console.log(num);

        num *= 5;
        console.log(num);

        num /= 3;
        console.log(num);

        num %= 3;
        console.log(num);

    </script>
    
</body>
</html>

밸류

<!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>Document</title>
</head>
<body>
    <script>
        var num1;
        var msg1;

        num1 = 12345;
        msg1 = "Hello Javascript!!!";

        console.log(num1);
        console.log(msg1);

        //null - 의도적으로 null을 대입
        var value1 = null;
        // undefied - 선언만 된 상태
        var value2;

        console.log('value1 : ' + value1);
        console.log('value2 : ' + value2);

        var isMan = false;
        console.log(isMan);

    </script>
    
</body>
</html>
profile
//

0개의 댓글