The JavaScript array join() method is used to join the elements of an array as a string.
Syntax:
array.join (separator)
Parameters:
separator: It represents the separator that will be used between array elements and it is an optional parameter.
Returns:
A string that will contain the array elements with a specified separator.
Example:
<!DOCTYPE html> <html> <head> </head> <body> <script> var a = ["GOLD","SILVER","DIAMOND","RUBY","PLATINUM"] var result=a.join() document.writeln(result); </script> </body> </html>