Java_OutPut
head>
<meta charset="UTF-8">
<title>basic</title>
</head>
<script type="text/javascript">
//1. 개발자도구(f12 - console)에 출력
//console.log(내용)
console.log("hello2", 100, "aaa");
//2. 브라우저에 출력
//document.write(내용)
document.write("<h1>hello4</h1>")
//3. 경고창에 출력
alert("test");
</script>
<!-- 4. js파일로 출력 -->
<script type="text/javascript" src="test.js"></script>
<!-- console.log(document.getElementById("test3")); //콘솔에 test3 아이디 정보 출력
console.log("js-Hello"); //콘솔 출력
document.write("js-world"); //브라우저에 기입
-->
<body>
브라우저
<div id="test1"></div>
<div id="test2"></div>
<div id='test3'>hello</div>
<script type="text/javascript">
//4. 특정 태그, 클래스, ID에 출력
//document.getElementBy~(식별자).inner~= 내용
document.getElementById("test1").innerText = "test1출력"
document.getElementById("test2").innerHTML = "<h1>test2출력</h1>"
</script>
</body
test.js
console.log(document.getElementById("test3"));
console.log("js-Hello");
document.write("js-world");