JavaScript,删除,数组,元素,方法本文实例讲述了JavaScript删除数组元素的方法。分享给大家供大家参考。具体分析如下: JS中可以通过delete删除数组元素,但是删除后数组的大小不会改变 <script type="text/javascript"><!--var days = ["Sunday","Monday","Tuesday","Wednesday", "Thursday","Friday","Saturday"];document.write("Number of days:"+days.length); delete days[4];document.write("<br />Number of days:"+days.length);//--></script> 输出结果
Number of days:7Number of days:7 希望本文所述对大家的javascript程序设计有所帮助。 JavaScript,删除,数组,元素,方法
|