How to remove "," from a string in javascript

In this programming tutorial you will learn how to remove "," from a string in javascript. Couple of days i got requirement to remove "," from the string which is
a,b,c,d,e,f,g,h and make it abcdefgh. I have done it by using javascript. Let's have a look over how to do so
<script type="text/javascript">
        var str1 = "a,b,c,d,e,f,g,h";
        var str2 = str1.replace(/\,/g,"");
    </script>
str2 will contain the string abcdefgh.I hope you will find this tutorial very handy.
So that's it. I love your feedback.

0 comments: