Skip to content

Instantly share code, notes, and snippets.

@ThaddeusJiang
Last active August 10, 2018 01:43
Show Gist options
  • Save ThaddeusJiang/36a766b8bd8353fcdf19a299e3ff7e62 to your computer and use it in GitHub Desktop.
Save ThaddeusJiang/36a766b8bd8353fcdf19a299e3ff7e62 to your computer and use it in GitHub Desktop.
JavaScript 放在 head 还是 body ? <script src="./xxx.js" />

如果 JavaScript 运行依赖 HTML,放在 body。

包含 ReactDOM.render() 的 JavaScript or 业务逻辑

如果 JavaScript 运行不依赖 HTML,放在 head 中。

如 jQuery.js

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment