Concatenating JavaScript Array to CSV

Introduction
 
Here we will learn how to use the valueof() and the join() functions in the javascript.
 
Sample code 

function Concnact() {
            var arr = ['Devesh', 'C-sharpcorner', 'ASP.net', 'Csharp'];
             var str = arr.valueOf();
             var strJoin = arr.join("|");

             alert(str);
           alert(strJoin); 

        }

<asp:Button ID="Button1" runat="server" Text="Button" OnClientClick="return Concnact()"/>

OutPut : str

Devesh,C-sharpcorner,ASP.net,sharp
 
Output: strJoin
Devesh|C-sharpcorner|ASP.net|sharp
 
Conclusion
 
Using the methods, mentioned above, we can combine the array values in the javascript.
Ebook Download
View all
Learn
View all