throttle. However, Lodash's implementation is extremely over-engineered — reusing a lot of abstract functions and supporting weird and obscure use cases for older browsers; you're not expected to handle such edge cases within an interview setting.
- Implement Promise/Promise-related APIs:
- Implement Lodash functions:
map()with follow up of
- Convert all keys within an object into snake_case/camelCase
- DOM APIs:
- Observer pattern
Although the focus of such questions is not on algorithms, do pay attention to choice of data structures and the time complexity as well. Don't write a function that runs in O(n2) if it can pretty easily have an O(n) runtime with the use of hash maps.
Candidates are expected to take just around 10-15 minutes for a basic question. If you can tell that you received a basic question, try to finish within the suggested duration and do not intentionally take the entire interview to do one question. In most cases, you are expected to answer another coding question.
Advanced questions are usually given to more senior candidates and expect around 25-30 minutes to complete or arrive at a minimally working solution.
- Write a templating engine that does variables substitution and simple conditionals.
- Generate table of contents/outline from a HTML page (similar to Google Docs autogenerated outline).
- Always strive to write pure functions, aka functions which don't rely on state outside of the function and doesn't cause side effects.
- If you're writing a recursive function, ask whether there's a maximum stack depth limit.
- Some nested data structures can have recursive references to itself. Do clarify that there are no self-references/cycles within the object/ask if you need to handle them (usually the answer is "No").