4 colors suffice

Is there a javascript implementation of the 4-color theorem? I’ve tried something here but my approach is too naive to be successful.

4 color can be difficult to solve, here’s a solution using clingo: