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

169
Vistas
insertAdjacentHTML is inserting a comma after every loop

I am trying to loop gifts but the issue is after each object insertAdjacentHTML is inserting a comma, How can I be able to remove the comma?

            document.querySelector(`.chat-content`)?.insertAdjacentHTML(
              'beforeend',
              `<div class="gifts flex items-center h-20 gap-2">
                    ${gifts.map((gift: any) => `
                        <div class="gift bg-skin-field text-primary-yellow">
                            <i class="fas fa-gift"></i>
                            <span class="text-gray-400">${gift.channelId}</span>
                            <span>$${gift.price}</span>
                        </div>
                        `,
          )}
                </div>`,

enter image description here

about 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

gifts.map(.....) returns an array, which by default stringifies using a comma as delimiter. You'll want to explicitly convert this array to a string yourself, specifying there should be no delimiter:

${gifts.map(.....).join("")}
about 4 years ago · Santiago Trujillo 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