How to convert array to array object,like
['in','gs'] to [{"state":"in"},{"state":"gs"}]
How to convert array to array object,like
['in','gs'] to [{"state":"in"},{"state":"gs"}]
map over it and return a new array
let arr = ['in','gs']
let newArr = arr.map(item => ({state: item}));
console.log(newArr);