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

214
Vistas
create a range of years without using the range method

Is there another way to produce this array with code that does not use the range method?

Here is and example of what im looking for but using the range method.

const years = range(1990, getYear(new Date()) + 1, 1);

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

0

Yes you can achieve this by writing your own function

    const generateDates = (startYear) => {
        let currentYear = new Date().getFullYear(), years = [];
        startYear = startYear || 1980;  
        while ( startYear <= currentYear ) {
            years.push(startYear++);
        }   
        return years;
    }
    
    console.log( generateDates(2019-20));

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