Skip to content

Instantly share code, notes, and snippets.

@beiweiqiang
Created March 13, 2019 00:25
Show Gist options
  • Select an option

  • Save beiweiqiang/332a6efcc67cdd6cf25caa2ba9ebf7f9 to your computer and use it in GitHub Desktop.

Select an option

Save beiweiqiang/332a6efcc67cdd6cf25caa2ba9ebf7f9 to your computer and use it in GitHub Desktop.
defer 脚本总是按照指定它们的顺序进行执行
console.log('app2.js: 1 -> -> ', 'apps');
console.log('app3.js: 1 -> -> ', 'apps');
console.log('app4.js: 1 -> -> ', 'apps');
console.log('app5.js: 1 -> -> ', 'apps');
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<script defer src="index.js"></script>
<script defer src="app2.js"></script>
<script defer src="app3.js"></script>
<script defer src="app4.js"></script>
<script defer src="app5.js"></script>
</head>
<body>
<div>
123123
</div>
</body>
</html>
console.log('index.js: 1 -> -> ', 'index');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment