JavaScript

퇴근 후 JS- 데이터 표현 방법(innerHTML, console.log(), alert()document.write().

제이아이엔 2023. 3. 16. 22:44
반응형

https://www.w3schools.com/js/js_output.asp

 

JavaScript Output

W3Schools offers free online tutorials, references and exercises in all the major languages of the web. Covering popular subjects like HTML, CSS, JavaScript, Python, SQL, Java, and many, many more.

www.w3schools.com

이번 페이지는

 

JavaScript can "display" data in different ways:

  • Writing into an HTML element, using innerHTML.
  • Writing into the HTML output using document.write().
  • Writing into an alert box, using window.alert().
  • Writing into the browser console, using console.log().

말그대로 화면에 데이터를 출력할 수 있는 4가지 방법

 

사용법만 알아두자

 

innerHTML = <data>

document.write(<data>)

alert(<data>)

console.log(<data>)

 

window 는 기본 옵션이기에 alert만 가능하다

번외)

window.print() 하면 현재 화면 출력한다고 합니다.

728x90