This might be a fool question but let me try to explain myself, I want to run a function multiple times (insertOffice()
) and each time I run it, add a number to a const, this number will increase depending of the times I want to run the code (in this case is 5).
Here is what I have tried:
function insertOffice() {
var y = loop(i);
console.log(y)
}
function loop() {
for (var i = 1; i < 5; i++) insertOffice(i);
}
loop();
As you can see, lopp()
runs insertOffice()
5 times, and insertOffice()
print the numbers, I expect to print
1
2
3
4
5
I used this question to build my loop()
function.