Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

221
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda