score:1

Accepted answer

if you really mean an object {strawberry: true, watermelon: true, pear: true} (an associative array), not an array,

const options = [
    { label: "strawberry 🍓", value: "strawberry"},
    { label: "watermelon 🍉", value: "watermelon" },
    { label: "pear 🍐", value: "pear" },
];
const optionsobject = {};
options.foreach(({value}) => optionsobject[value] = true);

(you can also do this with .reduce if you really want to:)

const optionsobject = options.reduce((obj, {value}) => {
  obj[value] = true;
  return obj;
}, {});

Related Query

More Query from same tag