var let const
var let可以一次声明多个变量且不赋初始值,const声明一定要赋初始值
![](https://i-blog.csdnimg.cn/blog_migrate/ae6773d3d9655cf48a5989091a4503aa.png)
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<script>
// var
var a;
var b,c,d;
console.log(a,b,c,d);
// let
let h,j;
console.log(h,j);
</script>
</body>
</html>
![](https://i-blog.csdnimg.cn/blog_migrate/e6663ff99841f28a1739bf5b7e0b055d.png)
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<script>
//const
const k;
console.log(k);
</script>
</body>
</html>
var可以重复声明重新赋值,let不能重复声明可以重新赋值,conts不能重复声明,值不能改变就是不能重新赋值
![](https://i-blog.csdnimg.cn/blog_migrate/75e35fc09de7ba9b4777abdb9700936f.png)
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<script>
var a=1;
var a=2;
a=3;
console.log(a);
</script>
</body>
</html>
![](https://i-blog.csdnimg.cn/blog_migrate/69e267821cb6c1db772240e595adbcaa.png)
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<script>
// 可以重新赋值
let b=4;
b=2;
console.log(b);
</script>
</body>
</html>
![](https://i-blog.csdnimg.cn/blog_migrate/2524057824b620aedc41345026d7db2e.png)
<!DOCTYPE html>
<html>
<he