I Have Array data Like this
Subcategories:["Wooden Furniture","Office Furniture","Kitchen Furniture","Modular Office Furniture","Industrial Furniture","Steel Furniture","Living Room Furniture","|Storage and Display Furniture","Entryway Furniture","Inflatable Furniture","Patio Furniture & Accessories","Storage and Display Furniture"," Office & Commercial Furniture "]
Now I want To Assign same Key To each Element In it. Basically I want To Make Key Pair Value. please help . thanks
CodePudding user response:
You can use Array.prototype.map
.
const directories = Subcategories.map(sub => {
return { your_keyname: sub }
})