Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

265
Views
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 answers
Answer question

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 Report

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!