1 安装nodejs
- https://nodejs.org/en/download/ 下载适合的版本
- 一路下一步安装好
- cmd下执行相关的命令,表示安装好了
C:\Users>node -v
v16.13.1
C:\Users>npm -v
8.1.2
2 vscode开发javascript
- 快速生成测试html
https://www.cnblogs.com/xiaozhangzhang/p/9684778.html - 新建js文件js1/helloworld.js,内容为
console.log("Helloworld")
- 引入js文件
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<!--引入外部的js文件-->
<script type="text/javascript" src="js1/helloworld.js"></script>
<body>
</body>
</html>
- 将vscode当中一票关于html的插件都装上,包括格式化等
- chrome打开网页,查看console输出Helloworld.