JavaScript Array Method : join()

The join() method is used to join all the elements of an array into a string. The syntax is as follows :
  array.join(separator);
Example :
<script>
  var webdev = ["HTML", "CSS", "Javascript", "MySql", "PHP"];
  var mystr = webdev.join();
  document.write(mystr + "<br/>");
  var mystr = webdev.join(" | ");
  document.write(mystr + "<br/>");
  var mystr = webdev.join(" * ");
  document.write(mystr);
</script>
Output :


Next Topic :