Doubt in the code

Javascript Interval

Javascript Interval function

Start Timer

in the above code, Start Timer, we are including peranthasis in the function call, but in the above function call, setInterval(increment_counter, 1000); you are not including peranthasis like increment_counter(). I tried running the code by including peranthasis in the code but the timer is not automated. the timer is incrementing after every click.


setInterval(increment_counter, 1000);
With the () you are invoking the function immediately. Above is passing the function as a reference and it will be called after the delay time.

Using string argument… the string will be evaluated as script at end of timer delay


@Nikhil Can you please share the code that you are referring to?

Javascript Interval

Javascript Interval function

Start Timer


@Nikhil Please remember to format the code. There will be an option like </> in the text editor when you create a post.



Your code is correct.What is the issue?