JS 조건문

tpids·2024년 6월 6일

JS

목록 보기
12/40

조건문

< 주어진 조건을 비교·판단하여 결과를 얻는 구문>

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // 조건문 -> if, else if, else, switch
        // 조건문을 작성할 때, ?? 6/5
        let num = 10;
        if(num < 10) {
            console.log("작습니다.");
        } else if(num > 10) {
            console.log("큽니다!");
        } else {
            console.log("같습니다!");
        }
    </script>
</body>
</html>
profile
개발자

0개의 댓글