Seeking assistance in properly formatting data using the reduce method
const testData = { a: [1], b: [2, 3, 4], c: [] };
Objective is to convert to: a=1&b=2,3,4 Current output: a=1&b=2,3,4&
const createUrlString = params =>
Object.keys(params)
.map(
attr => (params[attr].length ? `${attr}=${params[attr].join(',')}` : '')
)
.join('&');
const testData = { a: [1], b: [2, 3, 4], c: [] };
const filterString = createUrlString(testData);