3.6语句

语句

if语句 (推荐花括号包起来)
do white (先执行一次,再判断)
white (先判断,再执行)
for (循环内部的变量,外部也可以访问到,没有块级作用域)
for in (枚举对象属性值,建议先检测是不是null或者undefined)
label (Labels are not very commonly used in JavaScript since they make
programs harder to read and understand. As much as possible, avoid
using labels and, depending on the cases, prefer calling functions or
throwing an error.)(难读懂,尽量不经常使用)
break continue 跳出循环
with 作用域作用在一个对象上(严格模式不允许使用)
switch 不一定是常量,也可以是变量,或者表达式

for while

var count = 10;
for(var i = 0; i < count; i++){
	l(i);
}

var count = 10;
var i = 0;
while(i < count){
	console.log(i);
	i++;
}
posted @ 2017-12-14 15:32  IT-caijw  阅读(93)  评论(0编辑  收藏  举报