You Don't Know JS by Kyle Simpson. The PDFs are one of the most starred repos on GitHub: https://github.com/getify/You-Dont-Know-JS
Also more to your question, "The Browser Hacker's Handbook" and "The Web Application Hacker's Handbook" I also think are really helpful in understanding how browsers work. Sadly a not better documented subject.
Visiting the list of APIs on Mozilla's website is also helpful.