The most common and best technique to call a function at the start of a setInterval is to call it before the first setInterval:
You may use this approach of a self-executing function that returns itself if you really want to isolate the function call to the setInterval:
The disadvantage of this design is that it creates a maintenance difficulty, as the next developer will have no idea what’s going on.
A # at the beginning of a property or method’s name makes it private: To make a property or method private, add a # to the beginning of its name.
When you retrieve the value of an input[type=number], valueAsNumber returns the value as a Number type instead of the typical string representation.
Checkout this code in action,