Combing an Array Elements into Strinds



Write a JavaScript code to implement concat method of array.

<html>
  <head>
    <title>Array Demo</title>
      <script>
      
        var a =new Array();

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

            var r=a.concat("VB");
            document.write("After joining =" +r);

            var r1=a.concat(".NET","PHP");
            document.write("After joining =" +r1);

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

Output:

After joining =C,C++,Java,VB
After joining =C,C++,Java,.NET,PHP