<!DOCTYPE html>
<html>
<body>
<h1>JavaScript Arrays</h1>
<h2>The toString() Method</h2>
<p>The toString() method returns an array as a comma separated string:</p>
<p id="workingdemo"></p>
<script>
const hero = ["Antman","Spiderman","superman","Wonderwoman"];
document.getElementById("workingdemo").innerHTML = hero.toString();
</script>
</body>
</html>
Output
JavaScript Arrays
The toString() Method
The toString() method returns an array as a comma separated string:
Antman,Spiderman,superman,Wonderwoman
Use of toString() method in Javascript
admin Changed status to publish December 19, 2023