510是怎么來(lái)的?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>數(shù)組長(zhǎng)度</title>
<script language="javascript">
?var mynum=new Array(65,90,88,98);
?
var arr=[98,76,54,56,76]; // 包含5個(gè)數(shù)值的數(shù)組
document.write(arr.length); //顯示數(shù)組的長(zhǎng)度5
arr[20]=35;? //增加元素,使用索引為15,賦值為34
alert(arr.length); //顯示數(shù)組的長(zhǎng)度16
arr.length=10; //增大數(shù)組的長(zhǎng)度
document.write(arr.length);
</script>
</head>
<body>
</body>
</html>
2015-08-06
你數(shù)組初始長(zhǎng)度為5 輸出肯定是5啊 ?后面又把數(shù)組長(zhǎng)度設(shè)為10 輸出就為10 ?把概念理解清楚
2015-08-04
5是從這里來(lái)的
10是從這里來(lái)的