Doubt in the code


#1
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.


#2

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.

setTimeout(“numCount()”,1000);
Using string argument… the string will be evaluated as script at end of timer delay


#3

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


#4
Javascript Interval

Javascript Interval function

Start Timer

#5

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


#6


#7

Your code is correct.What is the issue?