js---省略花括号{}的几种表达式

在进行js的书写中,对于常见的if,for,while是可以简写,省略花括号{}的:

var a = 10,b = 20;
/**
 * if 简写
 */
if(a > b) console.log('a大');
if(a < b) console.log('b大');
/**/
if(a > b) console.log('a大');
else console.log('b大');

/**
 * for简写
 */
for(var i=0; i<10; ++i) console.log(i);

/**
 * while简写
 */
while (i > 10) console.log(i);
原文地址:https://www.cnblogs.com/e0yu/p/11243233.html