본문 바로가기
프로그래밍

자바스크립트 : Interactive Websites (코드카데미)

by Youngbin Kwon 2020. 8. 12.

HTML creates the skeleton of a webpage, but JavaScript introduces interactivity

Html은 웹페이지의 뼈대를 만들지만, 자바스크립트는 역동성을 부여한다.

 

The <script> element has an opening and closing tag. You can embed JavaScript code inbetween the opening and closing <script> tags.

자바스크립트 코드를 html 파일의 <script></script> 태그 사이에 넣을 수 있다.

 

You link to external JavaScript files with the src attribute in the opening <script> tag.

또는 src 구문을 통해 다른 곳에 있는 자바스크립트 파일을 불러올 수 있다.

 

By default, scripts are loaded and executed as soon as the HTML parser encounters them in the HTML file, the HTML parser waits to load the entire script before from proceeding to parse the rest of the page elements.

기본 구성으로, 스크립트는 HTML파서가 파일에서 script구문을 마주했을 때 실행되며, 이때 파서는 스크립트를 모두 실행하고 나머지 요소들을 파싱한다.

 

The defer attribute ensures that the entire HTML file has been parsed before the script is executed.

script 문에 'defer'를 선언할 경우 다른 HTML 요소들을 모두 파싱하기 전에는 스크립트문을 실행하지 않는다.

 

The async attribute will allow the HTML parser to continue parsing as the script is being downloaded, but will execute immediately after it has been downloaded.

script 문에 'async'를 선언할 경우에는 HTML 요소를 파싱하는 중에 스크립트를 다운로드 하며, 다운로드가 완료되는대로 실행한다.

 

참조 - 엘리 드림코딩 2강 (링크)

댓글