Leetcode Breadth First Search Algorithm Javascript W3schools