Implement in JavaScript the BFS algorithm (Breadth First Search) to find the shortest path to exit from a labyrinth, starting from certain cell.
Print the shortest path as sequence of adjacent cells from start to the exit. If several shortest paths exist, print one of them. If no path goes outside of the labyrinth, print "No path to exit the labyrinth".
Implement in JavaScript the BFS algorithm (Breadth First Search) to find the shortest path to exit from a labyrinth, starting from certain cell.
Print the shortest path as sequence of adjacent cells from start to the exit. If several shortest paths exist, print one of them. If no path goes outside of the labyrinth, print "No path to exit the labyrinth".
Sample labyrinth (maze) definition in JS:
Sample output from your solution for the above example: