I have an object like this:
var person = { name: "John", surname: "Smith", phone: "253 689 4555" }
I want:
John,Smith,253 689 4555
Is there some easy way?
If possible, could you please provide an example where I can also define the separator?
You can use this one-liner in modern browsers
Object.keys(person).map(function(k){return person[k]}).join(",");
2.1m questions
2.1m answers
60 comments
57.0k users