Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var repeticion = setInterval(function aleatorio() {
- var rand = myArray[Math.floor(Math.random() * myArray.length)];
- if (rand == 200) {
- console.log("HTTP 200! Encontrado!");
- encontrado = true;
- } else if (rand == 500) {
- console.log("HTTP 500! Error interno del servidor");
- encontrado = true;
- } else if (rand == 204) {
- console.log("HTTP 204!");
- } else if (rand == 404) {
- console.log("HTTP 404!");
- }
- cont++;
- if (encontrado === true) {
- stopFunction();
- }
- }, 1000);
- function stopFunction() {
- clearInterval(repeticion);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement