var data = Math.random()
setInterval(function interval() {
console.log(data)
}, 1500)
I want to get the updated value of var data
from setinterval
function, but I'm not able to get the updated value of var data
, don't change this line
var data = Math.random()
This line is mandatory. I can't change this line somehow. How can I get the updated value?