In my Javascript code I am trying to set up this code
if(this.boolean == true) {
setTimeout(function(){ this.boolean = false; }, 2000);
}
But for some reason it won't work, the boolean just remains true. How can I fix this/what can I do instead? The setTimeout works with other lines of code but weirdly not this one.