If I have an array of strings, I can use the .join() method to get a single string, with each element separated by commas, like so:
.join()
[\"Joe\", \"
try this
var x= [ {name: "Joe", age: 22}, {name: "Kevin", age: 24}, {name: "Peter", age: 21} ] function joinObj(a, attr) { var out = []; for (var i=0; i "Joe, Kevin, Peter" var y = joinObj(x,'age'); y > "22, 24, 21"