
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<script asyc src="main.js"></script>
</head>
<body>
</body>
</html>
asyc는 블린형이고 htm이 실행하다가 main.js 다운로드가 완료되면 파싱을 멈추고 자바스트립트를
실행하고 다시 나머지 html을 실행합니다.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<script defer src="main.js"></script>
</head>
<body>
</body>
</html>
defer은 자바스크립트를 다운로드를 시키고 html이 다 실행되고 다시 자바스크립트를 실행된다.
defer은 순서대로 실행되기 때문에 더 확실하다.
참고
순수 자바스크립트를 할때
"use strict"
console.log("hellow world");
"use strict"를 선언하면
자바스크립트 엔진이 효율적으로 사용되게 된다.
'JAVASCRIPT' 카테고리의 다른 글
| codecademy 객체 예제 (0) | 2020.07.08 |
|---|---|
| 자바스크립트 es6 $ 기능 ` 의 기능 (0) | 2020.07.07 |
| OBJECTS Pass By Reference (0) | 2020.06.25 |
| Nested Objects (0) | 2020.06.25 |
| OBJECTS Methods (0) | 2020.06.25 |