I have an array of string for example like this:
var names = ["sam", "john", "tom", "travis", "jack"]
And I need to create JavaScript object which will contain all these names separated by , by one key.
Look what I want:
var obj = {names : "sam, john, tom, travis, jack"}
I'm not familiar with JavaScript. I understand that I need to loop through my array of string and somehow append values to my object.
I am using jQuery if there's something in that which would help.
var obj = {names : ["sam", "john", "tom", "travis", "jack"]}?