I am looking to trigger a function automatically upon certain dynamically changing conditions in my JavaScript code. I attempted using the document.body.onload
method, but it did not work as expected.
document.body.onload = myFunction()
function myFunction(){
if(start == true && moves % 2 == 0){
alert("Function")
}
}