delete





js/script.js
  • var ara = [1, 2, 3, 4, 5];
  • delete ara[2];
  •  
  • function funMake() {
  •  for(var i=0; i<ara.length; i++) {
  •   document.write(ara[i] + '<br />');
  •  }
  • }
  • var ara = [1, 2, 3, 4, 5];
  • delete ara[2];
  •  
  • function funMake() {
  •  for(var i=0; i<ara.length; i++) {
  •   document.write(ara[i] + '<br />');
  •  }
  • }


index.html
  • <!DOCTYPE html>
  • <html>
  • <head>
  •  <meta charset="utf-8" />
  •  <title>New Page</title>
  •  <script src="js/script.js"></script>
  • </head>
  • <body>
  • <script>
  •  funMake();
  • </script>
  • </body>
  • </html>
  • <!DOCTYPE html>
  • <html>
  • <head>
  •  <meta charset="utf-8" />
  •  <title>New Page</title>
  •  <script src="js/script.js"></script>
  • </head>
  • <body>
  • <script>
  •  funMake();
  • </script>
  • </body>
  • </html>