I have an array which has following String values - ['WATER','ENERGY','PAPER','FOOD SAFETY','FOOD AND BEVERAGE', 'INSTITUIONAL','PEST']
Im trying to convert this into an array of objects with a key and value pair but unable to do so. Here is my code:
handleFavOptions(result){
console.log('divisions data in handleFavOptions', result);
this.divisionFilterOptions = [];
this.tempArray = result.map((key) => (
{
label: key,
value: result[key]
}
));
console.log('temp array is',this.tempArray);
the first console log is showing proper output as below:

But surpringly in the following code the console shows empty Array
this.tempArray = result.map((key) => (
{
label: key,
value: result[key]
}
));
console.log('temp array is',this.tempArray); // Shows blank
Am I iterating in the wrong way? I need in this form where there is a label and key. And the label and key will both be same.