๋ฐ์ํ
- head + defer
script ํ๊ทธ๋ฅผ ์ฌ์ฉํ ๋ defer ์์ฑ ์ฌ์ฉํ๊ธฐ
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<script defer src='main.js'></script>
</head>
<body>
<div></div>
</body>
</html>
์ด ๋ฐฉ๋ฒ์ด ๊ฐ์ฅ ์ ์ฉํ๋ค.
- use strict
์์ vanilla js๋ฅผ ์ฌ์ฉํ๋ ค๋ฉด ์ค์ ๋ฐฉ์ง๋ฅผ ์ํด use strict์ ์ฌ์ฉํ๋ ๊ฒ์ด ์ข๋ค.
(TypeScript ์ฌ์ฉํ ๋ ์ ์ธํ ํ์ ์์)
'use strict'
console.log('Hello world');
๋ฐ์ํ
'JavaScript > JavaScript' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
๊ฐ๋น์ง ์ปฌ๋ ํฐ(GC) (0) | 2021.10.22 |
---|---|
[๋๋ฆผ์ฝ๋ฉ by ์๋ฆฌ] JavaScript ๊ธฐ์ด ๊ฐ์(2) (ES5+) (0) | 2021.10.06 |
[JavaScript] ํจ์ (0) | 2021.02.11 |
[JavaScript] ๊ฐ์ฒด (0) | 2021.02.11 |
[JavaScript] ๋ฐ๋ณต๋ฌธ (0) | 2021.02.02 |
๋๊ธ