首页 > 代码库 > js 数组

js 数组

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>nnn</title>
</head>
<body>

<script>
var i;
//var mycars = new Array();
//mycars[0] = "qqq";
//mycars[1] = "www";
//mycars[2] = "eee";
var mycars = [];
mycars.push("qqq");
mycars.push("www");
mycars.push("eee");
mycars.unshift("cccc")

for (i=0;i<mycars.length;i++){

document.write(mycars[i] + "<br />");
}
</script>

</body>
</html>

js 数组