Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

89
Views
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" }
]
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

JavaScript's Array.map() method is meant for a task like this. See this MDN page for details.

Below is an example solution for your needs.

const arr = ['HTML', 'CSS', 'JAVASCRIPT'];

const obj = arr.map(item => {
  return { key: item, text: item}
});

console.log(obj);

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!