The website have the button like this
When I click it will call the script below:
function count(){
let downloadTimer;
var timeleft = 30;
downloadTimer = setInterval(countDown,1000)
function countDown(){
document.getElementById("aaa").innerHTML = "Wait " ;
document.getElementById("hid").style.display = "none";
document.getElementById("timer").innerHTML = timeleft ;
timeleft -= 1;
if(timeleft < 0){
clearInterval(downloadTimer);
document.getElementById("timer").innerHTML = "1414-YYYI"
}
}
$(window).blur(function(){
console.log("blurred")
clearInterval(downloadTimer);
})
$(window).focus(function(){
console.log("focuesed")
downloadTimer = setInterval(countDown,1000);
})}
How I can change timeleft variables when I run function count() with google console I can run function count but I can't change timeleft variables
CodePudding user response:
You can't access that variable, but you can redefine the function.
function count() {
var timeleft = 30;
console.log("time left: " timeleft)
}
count();
var entire = count.toString();
var body = entire.slice(entire.indexOf("{") 1, entire.lastIndexOf("}"));
var count = new Function((body).replace("30", "2"))
count();