html中的js代码怎么放进js文件中

如题所述

将script标签中的js代码剪切出来 例如console.log(1);
新建一个js文件 例如index.js 把标签中的代码放进去。
在html里用script里引入index.js文件。<script src="index.js"></script>
温馨提示:答案为网友推荐,仅供参考
相似回答