Report question

Question: How to detect on-page 404 errors using JavaScript?