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

147
Views
JavaScript to create multiple URLs replacing one part of the URL in every iteration, but maintaining the rest of it?

I've been trying multiple codes but I cannot seem to crack it.

  1. I have a base URL that directs to the "About" page in every BMC journal page https://biomedcentral.com/about

  2. I want to target the "About" pages of ALL BMC journals in my list

example 1: BMC Primary Care = https://bmcprimcare.biomedcentral.com/about

example 2: BMC Neuroscience = https://bmcneurosci.biomedcentral.com/about

As you can see, each journal page differs in its initial code (above in bold).

I need a JavaScript code that will produce the same base URL multiple times, but each time with a different journal code. The goal is to target the "About" pages from ALL journals on my list.

I would so appreciate the help!!

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You can achieve it by using Array.map() along with String.split() and Template literals (`)

const baseURL = 'https://biomedcentral.com/about';

const journalCodeArr = ['bmcprimcare', 'bmcneurosci'];

const result = journalCodeArr.map((journalCode) => {
    const splitBaseURL = baseURL.split('//');
  return `${splitBaseURL[0]}//${journalCode}.${splitBaseURL[1]}`
});

console.log(result);

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!