Closed. This question needs to be more focused. It is not currently accepting answers.
is a built-in function that executes a block of code repeatedly with a
delay in between. It has two required arguments:
Function to be executed (you can think of it as similar to a function pointer in C)
Time in milliseconds to wait between executions
So the "1000" is simply the second argument and it means the passed function is executed every second.
The callback function (first argument) will execute after every 1000ms.
this.age++; // |this| refers to the global object
What we have here are two things going on.
An anonymous function is being passed as a callback parameter.
An integer is being passed as the second parameter.
The setInterval function will accept a callback as the first parameter, which is usually a function that executes after X amount of time.
The X amount of time is defined by the second parameter, which is an integer value defined in milliseconds.
The first argument to
setInterval is a function. This is a callback function that
setInterval will execute.
setInterval what to execute in one second.
This is the kind of question that would be better answered merely by going to
MDN to check the documentation for setInterval where a quick cursory glance will tell you that 1000 refers to a delay of 1000ms the method will wait before running the function passed in the first parameter again.
I don't want to be rude, but for a question that can be answered by reading the API documentation for the parameter of the method you are using, StackOverflow should probably not be your first resource.
Comments developer.mozilla.org is a very good resource for this type of thing Please do a modicum of research before asking.