I am stuck with a problem. I am trying to write some code with recursion. Each time button is clicked order get + 1 and console should print 1, 2, 3, 4 ... n, but instead it gets 1 2 2 3 3 3 3 My code:
function f(order) {
console.log(order);
order++;
$("#btn").on("click", function() {
f(order);
}
)}
f(1)
Thanks