HTML CSS Javascript jQuery AJAX PHP Java MORE

How to convert a array to string in JavaScript

<!DOCTYPE html>
<html>
<body>

<h2>JavaScript Array Methods</h2> 
<h2>toString()</h2>
<p>The toString() method returns an array as a comma separated string:</p>

<p id="demo"></p>

<script>
const fruits = ["BMW", "Mercedes", "Ferrari", "Tesla"];
document.getElementById("demo").innerHTML = fruits.toString();
</script>

</body>
</html>