JavaScript参考手册
声明 | Statements
Empty
空语句用来表明没有语句,尽管 JavaScript 语法希望有语句。
语法
;描述
空语句是一个分号(;),表示不会执行任何语句,即使 JavaScript 语法需要一个语句。相反,当你需要多行语句,但 JavaScript 只允许一个时,可以使用语句块;语句块可以将多条语句合并为一个。
示例
空语句有时与循环语句一起使用。以下示例使用空循环体:
var arr = [1, 2, 3];
// Assign all array values to 0
for (i = 0; i < arr.length; arr[i++] = 0) /* empty statement */ ;
console.log(arr)
// [0, 0, 0]提示:在使用空语句的情况下专门写上注释是个不错的主意,因为不是很容易区分空语句和普通的分号。下面的示例可能不是故意加上分号的:
if (condition);       // Caution, this "if" does nothing!
   killTheUniverse()  // So this always gets executed!!!另一个例子:if...else 语句不带花括号({})。如果three为true, 不会发生任何事,four不会执行,同时else从句中的launchRocket()函数也不会执行。
if (one)
  doOne();
else if (two)
  doTwo();
else if (three)
  ; // nothing here
else if (four)
  doFour();
else
  launchRocket();规范
| Specification | Status | Comment | 
|---|---|---|
| ECMAScript Latest Draft (ECMA-262)The definition of 'Empty statement' in that specification. | Draft |  | 
| ECMAScript 2015 (6th Edition, ECMA-262)The definition of 'Empty statement' in that specification. | Standard |  | 
| ECMAScript 5.1 (ECMA-262)The definition of 'Empty statement' in that specification. | Standard |  | 
| ECMAScript 3rd Edition (ECMA-262)The definition of 'Empty statement' in that specification. | Standard |  | 
| ECMAScript 1st Edition (ECMA-262)The definition of 'Empty statement' in that specification. | Standard | Initial definition. | 
浏览器兼容性
| Feature | Chrome | Edge | Firefox (Gecko) | Internet Explorer | Opera | Safari | 
|---|---|---|---|---|---|---|
| Basic support | (Yes) | (Yes) | (Yes) | (Yes) | (Yes) | (Yes) | 
| Feature | Android | Chrome for Android | Edge | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile | 
|---|---|---|---|---|---|---|---|
| Basic support | (Yes) | (Yes) | (Yes) | (Yes) | (Yes) | (Yes) | (Yes) | 
声明 | Statements相关
 
                                JavaScript 是一种高级编程语言,通过解释执行,是一门动态类型,面向对象(基于原型)的解释型语言。它已经由ECMA(欧洲电脑制造商协会)通过 ECMAScript 实现语言的标准化。它被世界上的绝大多数网站所使用,也被世界主流浏览器( Chrome、IE、FireFox、Safari、Opera )支持。JavaScript 是一门基于原型、函数先行的语言,是一门多范式的语言,它支持面向对象编程,命令式编程,以及函数式编程。它提供语法来操控文本、数组、日期以及正则表达式等,不支持 I/O,比如网络
 
         加载中,请稍侯......
 加载中,请稍侯......