javascript dijkstra from eloquentJS training