写法1:

condition && yes; // 等同于“if (condition) yes;”

写法2:

condition ? yes : no // 等同于“if (condition) {yes} else {no};”

写法3:

if (condition) {
   yes;
}else{
   no;
}

写法4:

if (condition) yes; // 等同于“if (condition) {yes};”