- Pick a browser
- Make sure it is an open source one
- Dig through its source code
Some repositories include:
Note that JavaScript native functions are generally not written in JavaScript (expect C or C++ most of the time). They are just exposed to JS through an API.
Also note that the code that scrolls a page when the spacebar is pressed isn’t even a function that is exposed to JS.