How to concatenate two string arrays in Javascript

You can easily create a string by concatenating the elements of an array using JavaScript’s join() method. The join() method also lets you specify a separator to separate array elements. The default separator is a comma (,).

How to concatenate two string arrays in Javascript
var langages = ["JavaScript", "HTML", "CSS", "PHP"];

alert(langages.join());      // JavaScript,HTML,CSS,PHP
alert(langages.join(", "));  // JavaScript, HTML, CSS, PHP
alert(langages.join("-"));   // JavaScript-HTML-CSS-PHP
alert(langages.join(" / ")); // JavaScript / HTML / CSS / PHP


JavaScript, HTML, CSS, PHP
JavaScript / HTML / CSS / PHP
mcqMCQPractice competitive and technical Multiple Choice Questions and Answers (MCQs) with simple and logical explanations to prepare for tests and interviews.Read More

Leave a Reply

Your email address will not be published. Required fields are marked *