Get your own website Result Size: 625 x 565
x
 
<!DOCTYPE html>
<html>
<body>
<h1>The Window Object</h1>
<h2>The setInterval() and clearInterval() Methods</h2>
<p id="demo1"></p>
<p id="demo2" style="color:red;"></p>
<script>
setInterval(function() {myFunc("param1", "param2")}, 2000);
function myFunc(p1, p2) {
  document.getElementById("demo1").innerHTML += "Hello";
  document.getElementById("demo2").innerHTML = "Parameters: " + p1 + " " + p2;
}
</script>
</body>
<!-- Mirrored from www.w3schools.com/jsref/tryit.asp?filename=tryjsref_win_setinterval_param2 by HTTrack Website Copier/3.x [XR&CO'2014], Wed, 21 Dec 2022 17:39:29 GMT -->
</html>