I have a question about JS increment(++). I know many people here asked about ++ and +1 difference in JS but none of them mentioned it in recursive call sentence.
QUESTION: I want to call function exec inside exec function recursively but the flowing script is not working well.
var exec = function(index){
if(index<7){
exec(index++);
}
}
exec(0);
output: Uncaught RangeError: Maximum call stack size exceeded
So I changed my script to the below and it worked well.
var exec = function(index){
if(index<7){
exec(index+=1);
}
}
exec(0);
Why it acts like differenctly in this example? Is my recursive call wrong?