Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

90
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda