Try the following:
let x = 0;
// Add your own method here
The way I see it should run like: show me the image => click on it => alert the number of i => show the image again => repeat the process until i reaches the number 5 => alert 1 => alert 2
setTimeout(Appear,Math.random() * 3000);
alert ('alert 2');
Nothing in your script actually “clicks” on anything. You add an event handler that will be executed when someone clicks on the element with the id
It worked!! Thank you!! I just had to change the positon of “if x>4 return ” one line up to satisfy another condition and did not had to use the “function call()” because there’s one similar up in my code.