mardi 25 mai 2021

Javascript function each 3 seconds glitching

I am creating a project in html, css, and JavaScript and I'm testing out a piece of code where each each 3 seconds, a function will go out but the function inside my code isnt working. I can't seem to figure out why. Here is my current code:

<body onload="myFunction()">



<script>
function myFunction() {
  setInterval(function(){ 
function test()
}, 3000);
}
function test() {
console.log ("Hello")
}
</script>

The part of the code where the function test() is declared is where the code is glitching but I can't figure out why, does anybody know whats wrong with this code?




Aucun commentaire:

Enregistrer un commentaire