JSFiddle - React, Tailwind, and code Playground

by tyhuangg

JavaScript

let next = current.checkNeighbors();
if (next) {
  next.visited = true;
  stack.push(current);
  removeWalls(current, next);
  current = next;
} else if (stack.length > 0) {
  current = stack.pop();
}