The functional programming paradigm is quite a popular thing at the moment and it is something I keep meaning to take more of a look at and add to my work process. I thought I would start with something very simple; a loop that would call another function and iterate over itself.
Here’s my example, as you can see it does nothing special just takes two values and increments one of them. It calls the console log function and if the count is not reached does the whole thing again.
const looper = (start, count) => {
// do something or call something
console.log(start);
start += 1;
if (start <= count) {
looper(start, count);
}
}
looper(1, 10);