I'm trying to get a variable from a setInterval() function but it always says that string is not defined. Code example below:
setInterval(function(){
var String = "test";
}, 1);
console.log(String)
what it should do is that it should log "test" into the console many times. but it does not work. any help or suggestions?
Edit: it works now. correct code is
setInterval(function(){
var myString = "test";
console.log(myString);
},1);