<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title>数组</title>
<script>
/**
* 对象: 容器集合
* 创建: var userobj = new Array();
* 如何访问数组元素: 通过数下标: userobj[0] userobj[1]
* 数组属性 length 数组长度
* 遍历数组
* js数组可以存储任意类型元素
*
*
*/
var userArrays = new Array(); //创建数组,数组初始大小10
userArrays[0] = "小明1";
userArrays[1] = "张三2";
userArrays[2] = "李四3";
userArrays[3] = "张三4";
userArrays[4] = "李四5";
userArrays[5] = 45;
userArrays[6] = 23;
var length = userArrays.length; //数组长度
console.log(length);
for (var i = 0; i < length; i++) {
console.log(userArrays[i]);
}
// console.log(userArrays[0]);
// console.log(userArrays[1]);
// console.log(userArrays[2]);
</script>
</head>
<body>
</body>
</html>
日期循坏
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title>日期时间对象</title>
<script>
var timeObj = new Date();
var year = timeObj.getFullYear();
var month = timeObj.getMonth()+1;
var date = timeObj.getDate();
var day = timeObj.getDay();//星期
console.log(year+"-"+month+"-"+date+" 星期"+day);
</script>
</head>
<body>
</body>