<!DOCTYPE html>
<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 x = [1,2,3,4];
document.getElementById("demo").innerHTML = x.join();
}
</script>
</body>
</html>