Schedules a timeout to compile and run code every timeout milliseconds.
id = self.setInterval(handler [, timeout [, ...arguments ] ]) id = self.setInterval(code [, timeout ]) The function callback handler.
The amount of time in milliseconds until the event occurs.
The values sent to the function.
<!doctype html>
<html>
<body>
<script>
function myfunction()
{
const r = Math.random() * 255;
const g = Math.random() * 255;
const b = Math.random() * 255;
const a = Math.random();
document.body.style.backgroundColor = `rgb(${r} ${g} ${b} / ${a})`;
}
const handler = myfunction;
const timeout = 1000;
const id = self.setInterval(handler, timeout);
</script>
</body>
</html>
<!doctype html>
<html>
<body>
<script>
function myfunction(myparameter1, myparameter2, myparameter3)
{
const r = Math.random() * myparameter1;
const g = Math.random() * myparameter2;
const b = Math.random() * myparameter3;
const a = Math.random();
document.body.style.backgroundColor = `rgb(${r} ${g} ${b} / ${a})`;
}
const handler = myfunction;
const timeout = 1000;
const argument1 = 255;
const argument2 = 255;
const argument3 = 255;
const id = self.setInterval(handler, timeout, argument1, argument2, argument3);
</script>
</body>
</html>
<!doctype html>
<html>
<body>
<script>
let r, g, b, a;
const code = `
r = Math.random() * 255;
g = Math.random() * 255;
b = Math.random() * 255;
a = Math.random();
document.body.style.backgroundColor = "rgb(" + r + g + b + "/" + a + ")"`;
const id = self.setInterval(code);
</script>
</body>
</html>
<!doctype html>
<html>
<body>
<script>
let r, g, b, a;
const code = `
r = Math.random() * 255;
g = Math.random() * 255;
b = Math.random() * 255;
a = Math.random();
document.body.style.backgroundColor = "rgb(" + r + g + b + "/" + a + ")"`;
const timeout = 1000;
const id = self.setInterval(code, timeout);
</script>
</body>
</html>