Communities for your favorite technologies. Explore all Collectives
Ask questions, find answers and collaborate at work with Stack Overflow for Teams.
Ask questions, find answers and collaborate at work with Stack Overflow for Teams. Explore Teams
Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
I have array like this var array =["123", "456", "789"]
var array =["123", "456", "789"]
How do I convert this into var string = "123", "456", "789"
var string = "123", "456", "789"
I tried join and other things so far I was unable to produce my desired result.
Any idea how it can be achieved?
var string = "789"
You could stringify the elements before joining.
var array = ["123", "456", "789"], result = array.map(a => JSON.stringify(a)).join(); console.log(result);
Add a comment
Start asking to get answers
Find the answer to your question by asking.
Explore related questions
See similar questions with these tags.
var string = "123", "456", "789"is justvar string = "789"