See the Code in action at: https://dango301.github.io/Dijkstra/ Note: Open the Console with F12 to understand what's going on behind the scenes!