Posted in Javascript onJanuary 15, 2014
1.使用length清空数组:
<script> var arr1 = ['aaa','bbbb','https://3water.com']; alert(arr1); arr1.length = 0; alert(arr1); //数组为空 </script>
2.使用length截短数组:
<script> var arr1 = ['aaa','bbbb','c','d','e']; arr1.length = 3; alert(arr1); //截断数组aaa,bbbb,c </script>
js利用数组length属性清空和截短数组的小例子
声明:登载此文出于传递更多信息之目的,并不意味着赞同其观点或证实其描述。
Reply on: @reply_date@
@reply_contents@