This article mainly introduces JavaScript to delete the elements of the array method, examples of JavaScript in the use of delete function, with a certain reference value, the need for friends can refer to the
The example in this article describes the way JavaScript deletes an array element. Share to everyone for your reference. The specific analysis is as follows:
JS can delete an array element through delete, but the size of the array will not change after deletion
?
1 2 3 4 5 6 7 8 9 |
<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> |
Output results
?
1 2 |
Number of days:7 number of days:7 |
I hope this article will help you with your JavaScript programming.