<html>
<body>
<p>Click the button to join the array elements into a string.</p>
<button onclick="myFunction()">Try it</button>
<p id="demo"></p>
<script>
function myFunction() {
var fruits = ["Banana", "Orange", "Apple", "Mango"];
var x = document.getElementById("demo");
x.innerHTML = fruits.join(" and ");
}
</script>
</body>
<!-- Mirrored from www.w3schools.com/jsref/tryit.asp?filename=tryjsref_join2 by HTTrack Website Copier/3.x [XR&CO'2014], Wed, 05 Jun 2019 14:01:56 GMT -->
</html>