Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

js array to object with keys

const arr = ['a','b','c'];
const res = arr.reduce((a,b)=> (a[b]='',a),{});
console.log(res)
 
PREVIOUS NEXT
Tagged: #js #array #object #keys
ADD COMMENT
Topic
Name
7+6 =