I have an array called labels with the values "Hat", "Chair", and "Pen". I am looking to convert this array into an object where each value is set to true, like so:
var output = {"Hat": true, "Chair": true, "Pen": true};
Can someone provide guidance or code on how to achieve this in JavaScript?
Thank you!