<!DOCTYPE html>
<html>

<head>
<meta charset="UTF-8">
<title></title>
</head>

<body>
<script type="text/javascript">
for(var i = 0; i < 10; i++) {
for(var j = 0; j < i; j++) {
document.write("*");
}
document.write("<br/>");
}

var m = 0;
var result = 0;
while(m <= 100) {
result += m;
m++;
}

document.write("0+1+2...+100 = " + result);
document.write("<hr>");

//for in
//定义数组
var arr = new Array();
//赋值
arr[0] = 10;
arr[1] = 100;
arr[2] = 1000;
arr[3] = 10000;
//使用for ... in 遍历
//for(变量 in 数组)
//每次循环,都取出数组的下标
for(var num in arr) {
document.write(arr[num]);
document.write("<br/>");
}
</script>
</body>

</html>