수업/└HTML&CSS

[2022.01.04]JavaScript_document.write(), typeof

onlyun 2022. 1. 5. 00:04

(결과 출력)

 

(이용 코드)

document.write( ); ,  typeof

 

(소스 코드)

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>2022.01.04_JavaScript 실습</title>
    <script>
        document.write(2022);
        document.write('<br/>'+2022+'<br/>');
        document.write('Hello '+2022+'<br/>');

        document.write('<br/>-----구분선-----<br/><br/>');

        document.write(3+5+'<br/>');
        document.write('3 + 5 : '+(3+5)+'<br/>');

        document.write('<br/>-----구분선-----<br/><br/>');

        let num;
        num=5;

        document.write('type of num : '+ typeof num +'<br/>');

        num='Busan';
        document.write('type of num : '+ typeof num +'<br/>');
    </script>
</head>
<body>
    <h3>JavaScript Practice</h3>
</body>
</html>