'I want to Convert array into Custom Object
I have array of Strings like this: let arr = ['HTML', 'CSS', 'JAVASCRIPT']
I have converted this array into an object using {...arr} method and the result is: { 0: "HTML", 1: "CSS", 2: "JAVASCRIPT" } I want this result in this format because I am using Fluent UI react dropdown and there inside options, we have arrays of objects having their own key and text. But I did not understand How do I customize my object like this -->
[
{key: "HTML", text: "HTML"},
{ key: "CSS", text: "CSS" },
{ key: "JAVASCRIPT", text: "JAVASCRIPT" }
]
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
