How To Delete An Array Entry Using JavaScript

  • 24 Feb, 2012

    The "delete" operator removes an array element in JavaScript , but oddly does not change the size of the array.<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>This producesNumber of days:7Number of days:7

    Comments Received:
    Please give your suggestions and feedback:

2009-2016 All rights reserved.