JavaScript Example (Program)
Learn Details

Q. Where do use join() method ?

किसी array के element को string में convert करने के लिए join() Method का Use करते हैं

Array_Name.join()

  • Example


    <script>
    var a = ["Apple", "Ball", "Cat", "Dog"];
     document.write(" <b>Before Medhod :  </b>"+a+" <b> and Data Type is :  </b>"+typeof a +" <br>");
     var b = a.join()
     document.write(" <b>After Medhod :  </b>"+b+" <b> and Data Type is :  </b>"+typeof b +" <br>");
       
    </script>
    Out Put : Before Medhod : Apple,Ball,Cat,Dog and Data Type is : object
    After Medhod : Apple,Ball,Cat,Dog and Data Type is : string