C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML
JavaScript TypedArray join() MethodThe JavaScript join() method is used to join all elements of an Array into a string. The elements will separated by a specified separator. The default separator is comma(,). Syntax:Array.join(separator) Parameters:It is optional, it can be either used as a parameter or not its default value is (,). Return value:It returns the String which contain the collection of array's elements. Browser Support:
ExampleJavaScript TypedArray join() Method <script type="text/javascript"> // JavaScript to illustrate join() method // input array var JavaTpoint = ['core java','C']; //joins the elements of the array. document.write("joins the elements of the array <br>"); document.write(JavaTpoint.join()); document.write("<br>"); //elements are seperated by dot (.). document.write("elements are seperated by dot (.) <br>"); document.write(JavaTpoint.join('.')); document.write("<br>"); //elements are seperated by hyphen (-). document.write("elements are seperated by hyphen (-)<br>"); document.write(JavaTpoint.join('-')); // expected output: arr[core javaC //core java.C //core java-C] </script> Output: Core java,C Core java.C Core java-C
Next TopicJavaScript TypedArray Object
|