How can I convert an array to an object by splitting strings?
You could take Object.fromEntries
with the splitted key/value pairs.
var data = ["gender-m", "age-20", "city-london", "lang-en", "support-home"],
result = Object.fromEntries(data.map(s => s.split('-')));
console.log(result);