I am looking for whole day about solution for this problem. So, my intention is to make something like a bingo numbers poping out. One after another. Now, problem I am experiencing is that always function is runned just once and I am getting 8 times same number. One after another. I am pretty much begginer with javascript so every help is appreciated.
var konjo = (i) => {
i = document.getElementById("testic").innerHTML +="<p> Brojic je " + x + "</p>";
}
var x = Math.floor(Math.random() * 49);
for(j = 1; j < 9;j++)
{
function trs(bass){
setTimeout(bass, 1000 * j);
}
trs(konjo);
}
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no">
<title>Bingac</title>
</head>
<body>
<div id="testic"></div>
</body>
</html>
Brojic je " + Math.floor(Math.random() * 49); + "
"; }, 1000*j); }` – Boo Jun 24 '18 at 13:58