<body>
    <h1>JavaScript</h1>
    <script>
      document.write('Hello World!');
    </script>
    <h1>html</h1>
    1+1
  </body>

자바스크립트는 동적이다. 저 write 안에 1+1을 입력하면 2가 출력된다.

  1. input
<input type="button" value="hi" onclick = "alert('hi')">
<!-- hi라고 적혀있는 버튼을 만들고 눌렀을 때 hi라는 경고창을 띄운다. -->
<input type="text" onchange="alert('change')">
<!-- 텍스트 입력칸의 값이 바뀌고 지정된 곳이 바뀌면 change라는 경고창 -->
<input type="text" onkeydown="alert('keydown')">
<!-- 텍스트가 작성되었을 때 경고창! -->

<aside> 💡 특정 이벤트를 찾고싶다면 HTML ‘~’ EVENT ATTRIBUTE 로 검색!

</aside>

  1. 콘솔 이용하기

<aside> 💡 파일 만들지 않고 우클릭 후 ‘검사’ 이후 ‘콘솔’ 탭을 이용

</aside>

alert('HTML elements are the building blocks of HTML pages. 
With HTML constructs, images and other objects, 
such as interactive forms, may be embedded 
into the rendered page. It provides a means to create 
structured documents by denoting structural semantics 
for text such as headings, paragraphs, lists, links, 
quotes and other items. HTML elements are delineated 
by tags, written using angle brackets.'.length)
<!-- alert는 경고창 .length하면 길이 -->

<aside> 💡 자바스크립트를 이용한다는 것은 파일 만드는 것 뿐만이 아니라 페이지 자체로 콘솔을 이용하는 방법도 있다. 이 때 콘솔에서 shift랑 엔터를 누르면 실행되지 않고 줄바꿈이 된다.

</aside>

3.1 콘솔_properties

<aside> 💡 https://developer.mozilla.org/ko/docs/Web/JavaScript/Guide/Grammar_and_Types

</aside>

검색해서 사용해보자.

3.2 콘솔 변수선언

<aside> 💡 var 을 이용해서 선언하자 ex) var name = ‘ryeoryeo’;

</aside>