1.使用length清空数组:
<script><BR> var arr1 = ['aaa','bbbb','http://www.jb51.net'];<BR> alert(arr1);<BR> arr1.length = 0;<BR> alert(arr1); //数组为空<BR></script>
2.使用length截短数组:
<script><BR> var arr1 = ['aaa','bbbb','c','d','e'];<BR> arr1.length = 3;<BR> alert(arr1); //截断数组aaa,bbbb,c<BR></script>