#How is the index not being incremented when console.log() it passes 0 index 3 times.
14 messages · Page 1 of 1 (latest)
yes but i++ is incremented and is passing through backtrack but stays 0
no, backtrack is called again with i = 0
so it starts again at 0
the "passes 0 index 3 times" are in different nested function calls
this is a case you should really step through with a debugger and not just console.logs
or use console.group and console.groupEnd!
i feel like i remember trying that and it just... not really working in node
ah I see whats happening. you initialize then check the condition. after that you go to the statement. you only go back to increment when the statement is complete but in this instance were using reccusion
oh, node. yeah, i can imagine it might be kinda suck on older nodes. not sure whether it's better on newer nodes
// Track amount of indentation required via `console.group()`.
but idk, i just don't remember it working. maybe my memory's faulty though