Changing Elements of an Arrary



Write a JavaScript code to Remove element From Arrary using splice method.

<html>
  <head>
    <title>Array Demo</title>
      <script>

        var a =new Array();

        a[0]="C";
        a[1]="C++";
        a[2]="Java";
        a[3]="SQL";

        document.write("Original Length =" + a.length + "<br>");
        a.splice(2);

        document.write("New Length =" + a.length + "<br>");
        
        for(var i=0;i < a.length;i++)
        {
            document.write(a[i]);
        }

      </script>
    </head>
  <body>       
</body>
</html>

Output:

Original Length =4
New Length =2
CC++