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

212
Vistas
How do you concatenate space between an array of arrays inside a map array?

Hello I want to know how do you format correctly a Multi-Array (An array of arrays) that is already inside of a map array (I'll try to be more brief this time).

Having this piece of code:

const [gradosData, setGradosData] = useState([])
const agregarComa = (grado, index) => {
        console.log(grado, index)
        console.log(grado[index])
    }

{productos.map((productos, index) => ( 

<td>{productos.grado}</td>

))

It looks like this:

enter image description here

I was thinking on making a function that will get the value of the array + index of the array and then let it do for each array of length map productos then copy each in another array value eee but got stuck this is what the console is printing (is printing the right values so I'm kind of in the right path)

enter image description here

THIS is what I want to achieve:

enter image description here

I think I sum it up pretty good let me know if requires something else

I just want to add a coma + space to make it look better

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

In your function agregarComa and console.log, the argument grado seems to be an array of strings. If you want to join these strings with a comma and a space you can simply to this:

grado.join(", ") // will return "4° Grado, 5° Grado, 6° Grado"

Arrays have a built-in join method in JavaScript, and you can check it out here.

Also in your jsx code, this should suffice to achieve your goal:

<td>{productos.grado.join(", ")}</td>
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