when javascript and arrays were new to me. I needed to transform an object array into a string in JavaScript using commas to divide the strings. I considered how to turn an array into a string, either with or without commas.
I discovered how to convert an object array to a comma-separated string in two different ways using JavaScript after searching Google. The array property’s join() and toString() functions can be used for this. I’ve included both examples so you can use it and understand how it operates.
Looking at both examples will benefit your project.
Example 1:
<!DOCTYPE html>
<html>
<head>
<title>Javascript - Convert Array into Comma Separated String Example </title>
</head>
<body>
<script type="text/javascript">
var websites = ['holidaylandmark.com','wizbrand.com','motosahre.in'];
document.write(websites.toString());
</script>
</body>
</html>
OutPut:
holidaylandmark.com,wizbrand.com,motosahre.in
Example 2:
<!DOCTYPE html>
<html>
<head>
<title>Javascript - Convert Array into Comma Separated String Example</title>
</head>
<body>
<script type="text/javascript">
var websites = ['holidaylandmark.com','wizbrand.com','motosahre.in'];
document.write(websites.join('='));
</script>
</body>
</html>
OutPut:
holidaylandmark.com=wizbrand.com=motosahre.in

I’m Abhishek, a DevOps, SRE, DevSecOps, and Cloud expert with a passion for sharing knowledge and real-world experiences. I’ve had the opportunity to work with Cotocus and continue to contribute to multiple platforms where I share insights across different domains:
-
DevOps School – Tech blogs and tutorials
-
Holiday Landmark – Travel stories and guides
-
Stocks Mantra – Stock market strategies and tips
-
My Medic Plus – Health and fitness guidance
-
TrueReviewNow – Honest product reviews
-
Wizbrand – SEO and digital tools for businesses
I’m also exploring the fascinating world of Quantum Computing.