0
How do you call a function every second in JavaScript?
I know that it’s something to do with setInterval but I can’t figure it out. Here’s what I have so far: function plusOne { document.getElementById("main").innerHTML = x; x++ } let x = 0 setInterval(plusOne,1000)
1 ответ
+ 1
It's all correct, except you forgot the parenthesis in the function declaration. You just need to use
function plusOne () {
to make it work