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

127
Vistas
How to store random numbers in muntiple items without repeating the last one javascript

I have already tried most similar answers but they didn't work or are too old.

i'm trying to generate random dates, so i already have the following:

  function randomIntFromInterval(min, max) {
    return Math.floor(Math.random() * (max - min + 1) + min)
  }

  const dataMonth = randomIntFromInterval(1, 12)
  const dataDay = randomIntFromInterval(1, 30)
  const data-Year = randomIntFromInterval(15, 22)

if i try to put more than 1 of them in react like this:

    return (
<h1> {dataMonth}/{dataDay}/{data-Year} </h1>
<h1> {dataMonth}/{dataDay}/{data-Year} </h1>
  )

it will generate equal number for both. How can i do it to generate unique for each that i want to?

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

0

Why not just call the function rather.

 return (
   <h1> {randomIntFromInterval(1, 12)}/{randomIntFromInterval(1, 30)}/{randomIntFromInterval(15, 22)} </h1>
   <h1> {randomIntFromInterval(1, 12)}/{randomIntFromInterval(1, 30)}/{randomIntFromInterval(15, 22)} </h1>
 )
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