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

149
Vistas
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 Respuestas
Responde la pregunta

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 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