The last paragraph at Styling & HTML - Anki Manual says :
Functions like window.alert are also not available. Anki will write javascript errors to the terminal, so if you’re running on a Mac or Windows computer, you’ll need to manually catch the errors and write them to the document to see them. There is no debugger available, so to figure out problems you’ll need to break down your code until you discover which parts are causing problems.
While the most helpful tool Chrome dev tool for debug is available as an addon https://ankiweb.net/shared/ino/31746032, so I think the doc should be updated and included it in, and even further incorporate the tool into anki.