省略if后的大括号

有大括号的时候
大括号里面所有的 都归if管。只有条件为真的时候 才会执行。
没有大括号的时候 只有下面的一句归if管,

也就是说 当只有一句的时候 大括号可以省略 其它的 没区别。

举例:

if(true) console.log('a')
console.log('b')
//a
//b

if(false) console.log('c')
console.log('f')
//f

if(false) 
    console.log('c')
    console.log('f')
//f
原文地址:https://www.cnblogs.com/wangtong111/p/12161271.html