Hello @igorgetmeabrain,
Where is the rest of the code? ( I’m getting a
Unexpected token '{' and let emptyCell = this.findNextEmpty(grid) is not a function when I try to execute the code).
When you don’t understand what the code is doing, you can use a debugger or Python tutor:
As you can see, Python tutor is more “visual”.
https://pythontutor.com/javascript.html#mode=edit
In general, when this happens it is because there is an incomplete mental model of how JS is executed. A step by step execution is a good idea when do you don’t understand the code, this is an answer that I wrote about recursion (a different exercise). Maybe can help you:
Use Recursion to Create a Countdown - Understanding - #3 by Diego_Perez
Cheers and happy coding ![]()