引入JavaScript文件的方法有以下几种:
<script>
标签引入外部JavaScript文件:<script src="script.js"></script>
<script>
// JavaScript code here
</script>
defer
属性延迟加载JavaScript文件:<script src="script.js" defer></script>
async
属性异步加载JavaScript文件:<script src="script.js" async></script>
<script>
元素的方式引入JavaScript文件:var script = document.createElement('script');
script.src = 'script.js';
document.head.appendChild(script);