Depth First Search (JavaScript)