I've got an array that looks like this:
thing1,thing2,thing3
I need to reformat it to look like this:
[
{ value: 'thing1', data: 'thing1' },
{ value: 'thing2', data: 'thing2' },
{ value: 'thing3', data: 'thing3' },
]
My current function looks like this, but clearly isn't working:
function combine_ids(ids) {
return (ids.length ? " [ { value: '" + ids.join("'," + " data: '" + ids + " ' } ] ") : "");
}