var quantidade = "200";
setInterval(function(){
var tempo = document.getElementById("banner").textContent;
var match = tempo.match(/[^\d](\d+)/);
var nr = match && match[1];
if(nr === "5"){
var red = document.getElementById("red").textContent;
var green = document.getElementById("green").textContent;
var black = document.getElementById("black").textContent;
if(red>black){
var corfinal = "black";
$("#enviarpreto").click();
}else{
var corfinal = "red";
$("#enviarvermelho").click();
}
}
if(tempo[5] === "d"){
var red2 = document.getElementById("red").textContent;
var green2 = document.getElementById("green").textContent;
var black2 = document.getElementById("black").textContent;
var meured = document.getElementById("meured").textContent;
var meublack = document.getElementById("meublack").textContent;
if(meured < 0){
quantidade = quantidade*2;
}else if(meupreto < 0){
quantidade = quantidade*2
}else{
quantidade = 200;
}
document.getElementById('betAmount').value = quantidade;
}
}, 1000);
What I want to do is that when the condition time [5] === d happens, multiply that if those values are negative. But I just want it to multiply once. But we come across a problem as it is in setinterval, it is constantly multiplying, because time [5] stays for 4 seconds.
How can I do that just make me 1x?
Thank you.