When you have to use a library or take over a codebase you have never seen, how do you learn it?
Suggested answer
The interviewer wants to know whether you have a method or just try things until they work. A good answer goes from broad to narrow:
- Find the version and the entry point. Look at which version
package.jsonuses, read the README and the entry file (for exampleindexormod). With a codebase, get the project and its tests running before you read deeply. - Follow one concrete flow instead of reading everything. Pick exactly the job you need to do (for example "receive a message and reply") and trace it from the public function inward.
- List your assumptions and check each one. With a Telegram library, for example: is the
datefield in seconds or milliseconds, does an edited message go through the handler, what happens when a handler throws. Every answer should point to a file and line in the source or in the official documentation. - Write a small script you can run to see the real behavior, ideally one that needs no network or outside service.
If you use AI, say exactly how: let it read the source of the exact version installed (in node_modules) instead of answering from memory, ask it to include the file and line number, and then open and read those yourself. The model's memory may be right for an older version, so a fluent answer can still be wrong for the version you have.
It is good to tell a real example, such as the time a wrong assumption about the time unit produced a date in January 1970, and you found it by running the code rather than by reading about it.
Bonus points: say that you write down what you learned (which file does what, where it is easy to go wrong) in the README or in notes, so the next person doesn't have to trace it again.