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

165
Vistas
its possible to call java script array sort of data on by one after click button

im very confused , to explain my problem and I have searched in various posts in here, but I can't find the solution I'm facing . so i want to ask, its possible to call an array sort of data in java script one by one after the button is clicked ? explain I have a script random like this

$(document).on("click", "#okok", function() {

  var myArray = [
    "5",
    "8",
    "7",
    "2"
  ];

  var randomItem = myArray[Math.floor(Math.random() * myArray.length)];
  var nilai = document.getElementById("pr");

  nilai.value = randomItem;

});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://code.jquery.com/jquery-1.10.2.min.js"></script>
<textarea name="pr" id="pr"></textarea>
<br>
<input type="button" id="okok" value="Start">

the script above displays array data one by one but random and not sort.. so i want the display data sort and not random like 2 , 5 ,7 ,8

thanks

about 4 years ago · Juan Pablo Isaza
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