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

261
Vistas
How can I push link to an JS array?

I have three links that express three different images. I want to push these links to an array and I can show off my images on the screen. How can I do that

This is my JS code, is that correct ?? Thanks a lot.

let cardsource = [
    "<a href = 'https://bom.to/Qd87vw'> Card 1</a>",
    "<a href = 'https://bom.to/P21flg'>Card 2 </a>",
    "<a href = 'https://bom.to/dFwwNw'>Card 3 </a>",
];
for (var index = 0; index < cardsource.lengh; index++) {
    console.log(cardsource[index]);
}

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

0

Don't push tag inside array, just push the link which directly gives you the image.

let cardsource = ['https://bom.to/Qd87vw', 'https://bom.to/P21flg', 'https://bom.to/dFwwNw'];

cardsource.map((item) => <img src={item}>)

This is just to give you the logical view on what you must do instead what you have done. If you are working with .jsx this code would work.

about 4 years ago · Juan Pablo Isaza Denunciar

0

Please use insertAdjacentHTML function. Reference

let cardsource = [
    "<a href = 'https://bom.to/Qd87vw'> Card 1</a>",
    "<a href = 'https://bom.to/P21flg'>Card 2 </a>",
    "<a href = 'https://bom.to/dFwwNw'>Card 3 </a>",
];
cardsource.map(val => document.body.insertAdjacentHTML('beforeend', val));
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