I want to map the java script array into dictionary:
let myArray=['first','second','third'];
Expected Output
result={first:1,second:1,third:1}
Actual Output
result=[{element:1}, {element:1}, {element:1}]
Code:
let myArray=['first','second','third'];
let result=myArray.map(element=>{
return {element:1}
})