Javascript Floodfill Algorithm Problem With Implementing Pseudocode

Javascript Floodfill Algorithm Problem With Implementing Pseudocode