1.一个“=” 代表把b赋值给a
let a=1;
let b=2;
if(a=b){
console.log(a)
}
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/eba12e5b5a5b3e392c19d1eefe906210.png)
2.两个“==” 判断b是否等于a
let a=1;
let b=2;
if(a==b){
console.log(b)
}
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/93d54eb15a916b9b8a6672553ed93e97.png)
3.三个“===” a与b的类型也要相等
let a=2;
let b=“2”;
if(a===b){
console.log(b)
}
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/a6a6f2579857ef7331dbe158c53dd729.png)
当if里的条件为数字0时候,该字符串被当作false,例如:
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/37917f55f994af46c2d3eef95ccb885d.png)
除0外 null/undefined/NaN/""表达式时,统统被解释为false,此外均为true