I have a set which needs to be converted into an object with the set\'s unique values as the object keys and an empty string as each element\'s value in the object.
H
Create an object, then loop over the values in the set and create a property for each one. The reduce
method is probably the most compact way to do that.
const uom = new Set(['inches', 'centimeters', 'yards', 'meters']);
const result = Array.from(uom).reduce( (a,c) => { a[c]=""; return a; }, {});
console.log(result);