Document, Console

Namiya·2025년 6월 23일

JavaScript 연습

목록 보기
1/27
<!DOCTYPE html>
<html lang="ko">
<head>
    <meta name="viewport" content="width=device-width">
    <meta charset="UTF-8">
    <link rel="stylesheet" href="https://meyerweb.com/eric/tools/css/reset/reset.css">
    <title>Print on document and console</title>
</head>
<body>

    <script>

        /*
         * document 객체(object)
         * → DOM(Document Object Model)을 표현하는 객체
         *
         * document 객체의 write 메소드(method)
         * → DOM에 지정한 값(인자)을 출력하는 기능
         */
        document.write('JavaScript Programming');

        /*
         * console 객체
         * → 브라우저의 콘솔을 표현하는 객체
         *   
         * console 객체의 log 메소드
         * → 브라우저 콘솔에 지정한 값을 출력하는 기능
         * → 주로 디버그 메시지(Debug message) 등을 출력하기 위해 사용
         */
        console.log('Do your best!');
           
    </script>

</body>
</html>

0개의 댓글