I want to create a function such that
- each time the function runs, the value of variable
Pwill increase; - the number of times the function runs is set by the variable
runtimes.
For example:
var runtimes = '25';
var P = '1';
function send(){
//some function
}
After the first run, variable P will be 2 and the second run will start.
How can I do this?
You can call the function from a loop:
Or keep track of the iterations in the function itself and call it once: